public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Myers <bpm@sgi.com>
To: linux-nfs@vger.kernel.org
Subject: [RFC PATCH 4/4] If 'wsync' pass datasync=1 to vfs_fsync().
Date: Wed, 03 Feb 2010 17:44:44 -0600	[thread overview]
Message-ID: <20100203234444.17677.32390.stgit@case> (raw)
In-Reply-To: <20100203233755.17677.96582.stgit@case>


---
 fs/nfsd/vfs.c |   39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 89eb1b2..4b1973b 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -418,7 +418,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
 	if (!err) {
 		if (EX_ISSYNC(fhp->fh_export)) {
 			if (EX_ISWSYNC(fhp->fh_export)) {
-				vfs_fsync(NULL, dentry, 0);
+				vfs_fsync(NULL, dentry, 1);
 			} else {
 				write_inode_now(inode, 1);
 			}
@@ -1169,7 +1169,8 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
 		return err;
 	if (EX_ISSYNC(fhp->fh_export)) {
 		if (file->f_op && file->f_op->fsync) {
-			err = nfserrno(vfs_fsync(file, file->f_path.dentry, 0));
+			err = nfserrno(vfs_fsync(file, file->f_path.dentry,
+				       EX_ISWSYNC(fhp->fh_export) ? 1 :	0));
 		} else {
 			err = nfserr_notsupp;
 		}
@@ -1329,9 +1330,10 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	}
 
 	if (EX_ISSYNC(fhp->fh_export)) {
-		err = nfserrno(nfsd_sync_dir(dentry, 0));
+		err = nfserrno(nfsd_sync_dir(dentry,
+					EX_ISWSYNC(fhp->fh_export) ? 1 : 0));
 		if (EX_ISWSYNC(fhp->fh_export)) {
-			vfs_fsync(NULL, dchild, 0);
+			vfs_fsync(NULL, dchild, 1);
 		} else {
 			write_inode_now(dchild->d_inode, 1);
 		}
@@ -1465,7 +1467,8 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
 		*created = 1;
 
 	if (EX_ISSYNC(fhp->fh_export)) {
-		err = nfserrno(nfsd_sync_dir(dentry, 0));
+		err = nfserrno(nfsd_sync_dir(dentry,
+					EX_ISWSYNC(fhp->fh_export) ? 1 : 0));
 		/* setattr will sync the child (or not) */
 	}
 
@@ -1602,8 +1605,10 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
 		host_err = vfs_symlink(dentry->d_inode, dnew, path);
 
 	if (!host_err) {
-		if (EX_ISSYNC(fhp->fh_export))
-			host_err = nfsd_sync_dir(dentry, 0);
+		if (EX_ISSYNC(fhp->fh_export)) {
+			host_err = nfsd_sync_dir(dentry,
+					EX_ISWSYNC(fhp->fh_export) ? 1 : 0);
+		}
 	}
 	err = nfserrno(host_err);
 	fh_unlock(fhp);
@@ -1668,9 +1673,10 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
 	host_err = vfs_link(dold, dirp, dnew);
 	if (!host_err) {
 		if (EX_ISSYNC(ffhp->fh_export)) {
-			err = nfserrno(nfsd_sync_dir(ddir, 0));
+			err = nfserrno(nfsd_sync_dir(ddir,
+					EX_ISWSYNC(ffhp->fh_export) ? 1 : 0));
 			if (EX_ISWSYNC(ffhp->fh_export)) {
-				vfs_fsync(NULL, dold, 0);
+				vfs_fsync(NULL, dold, 1);
 			} else {
 				write_inode_now(dest, 1);
 			}
@@ -1772,9 +1778,12 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
 
 	host_err = vfs_rename(fdir, odentry, tdir, ndentry);
 	if (!host_err && EX_ISSYNC(tfhp->fh_export)) {
-		host_err = nfsd_sync_dir(tdentry, 0);
-		if (!host_err)
-			host_err = nfsd_sync_dir(fdentry, 0);
+		host_err = nfsd_sync_dir(tdentry,
+				EX_ISWSYNC(tfhp->fh_export) ? 1 : 0);
+		if (!host_err) {
+			host_err = nfsd_sync_dir(fdentry,
+					EX_ISWSYNC(tfhp->fh_export) ? 1 : 0);
+		}
 	}
 
 	mnt_drop_write(ffhp->fh_export->ex_path.mnt);
@@ -1857,8 +1866,10 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
 
 	if (host_err)
 		goto out_drop;
-	if (EX_ISSYNC(fhp->fh_export))
-		host_err = nfsd_sync_dir(dentry, 0);
+	if (EX_ISSYNC(fhp->fh_export)) {
+		host_err = nfsd_sync_dir(dentry,
+				EX_ISWSYNC(fhp->fh_export) ? 1 : 0);
+	}
 
 out_drop:
 	mnt_drop_write(fhp->fh_export->ex_path.mnt);


  parent reply	other threads:[~2010-02-03 23:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03 23:44 [RFC PATCH 0/4] wsync export option Ben Myers
2010-02-03 23:44 ` [RFC PATCH 1/4] Add 'wsync' " Ben Myers
2010-02-03 23:44 ` [RFC PATCH 2/4] Add datasync argument to nfsd_sync_dir() Ben Myers
2010-02-03 23:44 ` [RFC PATCH 3/4] If 'wsync' call vfs_fsync() instead of write_inode_now() Ben Myers
2010-02-03 23:44 ` Ben Myers [this message]
2010-02-04 15:19   ` [RFC PATCH 4/4] If 'wsync' pass datasync=1 to vfs_fsync() Christoph Hellwig
2010-02-04 17:20     ` bpm
2010-02-04 18:30       ` Christoph Hellwig
2010-02-04 18:38         ` Trond Myklebust
2010-02-04 18:40           ` Christoph Hellwig
2010-02-04 18:52             ` Trond Myklebust
2010-02-03 23:47 ` [ RFC PATCH 5/4 ] Add wsync export option to nfs-utils bpm
2010-02-03 23:58 ` [RFC PATCH 0/4] wsync export option Trond Myklebust
2010-02-04 15:21   ` Christoph Hellwig
2010-02-04 15:30 ` Christoph Hellwig
2010-02-04 18:15   ` bpm
2010-02-04 18:39     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100203234444.17677.32390.stgit@case \
    --to=bpm@sgi.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox