Skip to contentSkip to conversation

off_t in nfsd_commit needs to be loff_t

PATCH Miquel van Smoorenburg 2 participants 2 messages Feb 2, 2004 – Feb 6, 2004

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

While I was stress-testing NFS/XFS on 2.6.1/2.6.2-rc, I found that sometimes my "dd" would exit with:

	#  dd if=/dev/zero bs=4096 > /mnt/file
	dd: writing `standard output': Invalid argument
	1100753+0 records in
	1100752+0 records out

After adding some debug printk's to the server and client code and some tcpdump-ing, I found that the NFSERR_INVAL was returned by nfsd_commit on the server.

Turns out that the "offset" argument is off_t instead of loff_t. It isn't used at all (unfortunately), but it _is_ checked for sanity, so that's where the error came from.

Here's the fix: nfsd_commit-loff_t.patch

Should go into the next -rc, I guess.

include/linux/nfsd/nfsd.h +1 -1
diff -ruN -X /home/staff/miquels/diff-exclude linux-2.6.2-rc2.orig/include/linux/nfsd/nfsd.h linux-2.6.2-rc2/include/linux/nfsd/nfsd.h
@@ -86,7 +86,7 @@
 				struct svc_fh *res, int createmode,
 				u32 *verifier, int *truncp);
 int		nfsd_commit(struct svc_rqst *, struct svc_fh *,
-				off_t, unsigned long);
+				loff_t, unsigned long);
 #endif /* CONFIG_NFSD_V3 */
 int		nfsd_open(struct svc_rqst *, struct svc_fh *, int,
 				int, struct file *);
fs/nfsd/nfs3proc.c +2 -2
diff -ruN -X /home/staff/miquels/diff-exclude linux-2.6.2-rc2.orig/fs/nfsd/nfs3proc.c linux-2.6.2-rc2/fs/nfsd/nfs3proc.c
@@ -595,10 +595,10 @@
 {
 	int	nfserr;
 
-	dprintk("nfsd: COMMIT(3)   %s %d@%ld\n",
+	dprintk("nfsd: COMMIT(3)   %s %u@%Lu\n",
 				SVCFH_fmt(&argp->fh),
 				argp->count,
-				(unsigned long) argp->offset);
+				(unsigned long long) argp->offset);
 
 	if (argp->offset > NFS_OFFSET_MAX)
 		RETURN_STATUS(nfserr_inval);
fs/nfsd/vfs.c +1 -1
diff -ruN -X /home/staff/miquels/diff-exclude linux-2.6.2-rc2.orig/fs/nfsd/vfs.c linux-2.6.2-rc2/fs/nfsd/vfs.c
@@ -823,7 +823,7 @@
  */
 int
 nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
-               off_t offset, unsigned long count)
+               loff_t offset, unsigned long count)
 {
 	struct file	file;
 	int		err;

Mike.

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#1 lore raw
Quoted 7 lines · On Mon, 2 Feb 2004 at 13:02:18 +0100 Miquel van Smoorenburg wrote:

Turns out that the "offset" argument is off_t instead of loff_t. It isn't used at all (unfortunately), but it _is_ checked for sanity, so that's where the error came from.

Here's the fix: nfsd_commit-loff_t.patch

Should go into the next -rc, I guess.

should this also be applied to 2.4? the code looks the same...

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs