[NFS] Patch for problems with cdrom exported via NFS

From: Roderich Schupp (rsch@ExperTeam.de)
Date: Thu Jun 01 2000 - 12:08:41 EST


I have problems with a cdrom on a Linux box NFS-mounted from a Solaris
(2.6) host (using NFSv2). Certain applications (e.g. pkgadd) choke on
files on the cd. A stat on the Solaris side shows st_blksize and
st_blocks both 0 for files on the cdrom. I think this problem has also
been reported with HPUX clients to this list.

The reason is that isofs in Linux has i_blksize=0 and i_blocks=0 in
the inode. For a NFS gettattr call we blindly copy these values into
the fsattr structure. The fix is to set these to a sane value. A
similar fix exists in the NFSv3 server code. Patch against 2.4.0-test1

Cheers, Roderich

--- 2.4.0-test1/fs/nfsd/nfsxdr.c.~1~ Fri Mar 10 08:31:43 2000
+++ 2.4.0-test1/fs/nfsd/nfsxdr.c Tue May 30 09:25:07 2000
@@ -148,9 +148,15 @@
         } else {
                 *p++ = htonl((u32) inode->i_size);
- *p++ = htonl((u32) inode->i_blksize);
- *p++ = htonl((u32) inode->i_rdev);
- *p++ = htonl((u32) inode->i_blocks);
+ if (inode->i_blksize) {
+ *p++ = htonl((u32) inode->i_blksize);
+ *p++ = htonl((u32) inode->i_rdev);
+ *p++ = htonl((u32) inode->i_blocks);
+ } else {
+ *p++ = htonl((u32) BLOCK_SIZE);
+ *p++ = htonl((u32) inode->i_rdev);
+ *p++ = htonl((u32) (inode->i_size + 511) >> 9);
+ }
         *p++ = htonl((u32) inode->i_dev);
         *p++ = htonl((u32) inode->i_ino);
         *p++ = htonl((u32) inode->i_atime);

Even if it seems certain that you will lose, retaliate.  Neither wisdom
nor technique has a place in this. A real man does not think of victory
or defeat. He plunges recklessly towards an irrational death. By doing
this, you will awaken from your dreams. 

-- Hagakure - The Book of the Samurai

Roderich Schupp mailto:rsch@ExperTeam.de ExperTeam GmbH http://www.experteam.de/ Munich, Germany

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/

This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:13 EST