Skip to contentSkip to conversation

2.4.4-pre6 NFSv3 maximum filesize correction

PATCH New Trond Myklebust 1 participant 1 message Apr 23, 2001

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.4.4-pre6 NFSv3 maximum filesize correction

Hi Linus,

The current 2.4.4-pre series assumes that NFSv3 is always fully LFS
capable. This is of course not the case on 32bit architectures such as the 2.2.x series.
The following patch to fs/nfs/inode.c corrects this bug by using the
NFSPROC3_FSINFO call to provide the maximum supported filesize on the filesystem in question. On NFSv2 it will be set to 0x7FFFFFFF.

In doing this, I also noticed that knfsd was still supplying 4Gb as
its maximum supported filesize. The appended patch to fs/nfsd/nfs3proc.c causes the FSINFO call to return sb->s_maxbytes to the client.

Cheers,
Trond

fs/nfs/inode.c +1 -2
diff -u --recursive --new-file linux-2.4.4-pre6/fs/nfs/inode.c linux-2.4.4-maxfile/fs/nfs/inode.c
@@ -435,8 +435,7 @@
         if (server->namelen == 0 || server->namelen > maxlen)
                 server->namelen = maxlen;
 
-	if(version > 2)
-		sb->s_maxbytes = ~0ULL;	/* Unlimited on NFSv3 */
+	sb->s_maxbytes = fsinfo.maxfilesize;
 
 	/* Fire up the writeback cache */
 	if (nfs_reqlist_alloc(server) < 0) {
fs/nfsd/nfs3proc.c +1 -0
diff -u --recursive --new-file linux-2.4.4-pre6/fs/nfsd/nfs3proc.c linux-2.4.4-maxfile/fs/nfsd/nfs3proc.c
@@ -542,6 +542,7 @@
 		if (sb->s_magic == 0x4d44 /* MSDOS_SUPER_MAGIC */) {
 			resp->f_properties = NFS3_FSF_BILLYBOY;
 		}
+		resp->f_maxfilesize = sb->s_maxbytes;
 	}
 
 	fh_put(&argp->fh);