From 3a2eb47f48a9032a70a2b884a83e875c94208c6e Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Fri, 5 Jun 2009 12:35:15 -0400 Subject: [PATCH] --- yaml --- r: 153691 b: refs/heads/master c: 48e03bc515cff75718de5460458680a230ae997e h: refs/heads/master i: 153689: 8243da4ed01ac6cd0a9a2e45c957daa4746c75eb 153687: c2842f325b697256efb1e2ef634dd1a3d5eedd18 v: v3 --- [refs] | 2 +- trunk/fs/nfsd/vfs.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 3516e9ccf7c2..f8aa6f9dae65 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7eef4091a653c243a87e5375c54504cc03bec4d8 +refs/heads/master: 48e03bc515cff75718de5460458680a230ae997e diff --git a/trunk/fs/nfsd/vfs.c b/trunk/fs/nfsd/vfs.c index b660435978d2..f30cc4eadb0a 100644 --- a/trunk/fs/nfsd/vfs.c +++ b/trunk/fs/nfsd/vfs.c @@ -975,6 +975,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, __be32 err = 0; int host_err; int stable = *stablep; + int use_wgather; #ifdef MSNFS err = nfserr_perm; @@ -993,9 +994,10 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, * - the sync export option has been set, or * - the client requested O_SYNC behavior (NFSv3 feature). * - The file system doesn't support fsync(). - * When gathered writes have been configured for this volume, + * When NFSv2 gathered writes have been configured for this volume, * flushing the data to disk is handled separately below. */ + use_wgather = (rqstp->rq_vers == 2) && EX_WGATHER(exp); if (!file->f_op->fsync) {/* COMMIT3 cannot work */ stable = 2; @@ -1004,7 +1006,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, if (!EX_ISSYNC(exp)) stable = 0; - if (stable && !EX_WGATHER(exp)) { + if (stable && !use_wgather) { spin_lock(&file->f_lock); file->f_flags |= O_SYNC; spin_unlock(&file->f_lock); @@ -1040,7 +1042,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, * nice and simple solution (IMHO), and it seems to * work:-) */ - if (EX_WGATHER(exp)) { + if (use_wgather) { if (atomic_read(&inode->i_writecount) > 1 || (last_ino == inode->i_ino && last_dev == inode->i_sb->s_dev)) { dprintk("nfsd: write defer %d\n", task_pid_nr(current));