Commit 6a69bfee authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] off_t in nfsd_commit needs to be loff_t

From: Neil Brown <neilb@cse.unsw.edu.au>,

From: Miquel van Smoorenburg <miquels@cistron.nl>

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.
parent ce8b13c9
...@@ -595,10 +595,10 @@ nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp, ...@@ -595,10 +595,10 @@ nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp,
{ {
int nfserr; int nfserr;
dprintk("nfsd: COMMIT(3) %s %d@%ld\n", dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
SVCFH_fmt(&argp->fh), SVCFH_fmt(&argp->fh),
argp->count, argp->count,
(unsigned long) argp->offset); (unsigned long long) argp->offset);
if (argp->offset > NFS_OFFSET_MAX) if (argp->offset > NFS_OFFSET_MAX)
RETURN_STATUS(nfserr_inval); RETURN_STATUS(nfserr_inval);
......
...@@ -823,7 +823,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, ...@@ -823,7 +823,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
*/ */
int int
nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, 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; struct file file;
int err; int err;
......
...@@ -86,7 +86,7 @@ int nfsd_create_v3(struct svc_rqst *, struct svc_fh *, ...@@ -86,7 +86,7 @@ int nfsd_create_v3(struct svc_rqst *, struct svc_fh *,
struct svc_fh *res, int createmode, struct svc_fh *res, int createmode,
u32 *verifier, int *truncp); u32 *verifier, int *truncp);
int nfsd_commit(struct svc_rqst *, struct svc_fh *, int nfsd_commit(struct svc_rqst *, struct svc_fh *,
off_t, unsigned long); loff_t, unsigned long);
#endif /* CONFIG_NFSD_V3 */ #endif /* CONFIG_NFSD_V3 */
int nfsd_open(struct svc_rqst *, struct svc_fh *, int, int nfsd_open(struct svc_rqst *, struct svc_fh *, int,
int, struct file *); int, struct file *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment