[RFC PATCH 3/4] If 'wsync' call vfs_fsync() instead of write_inode_now().

Ben Myers
2010-02-03T23:44:41Z

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

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 1a64fb6..89eb1b2 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -415,9 +415,16 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
}
if (size_change)
put_write_access(inode);
- if (!err)
- if (EX_ISSYNC(fhp->fh_export))
- write_inode_now(inode, 1);
+ if (!err) {
+ if (EX_ISSYNC(fhp->fh_export)) {
+ if (EX_ISWSYNC(fhp->fh_export)) {
+ vfs_fsync(NULL, dentry, 0);
+ } else {
+ write_inode_now(inode, 1);
+ }
+ }
+ }
+
out:
return err;

@@ -1323,7 +1330,11 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,

if (EX_ISSYNC(fhp->fh_export)) {
err = nfserrno(nfsd_sync_dir(dentry, 0));
- write_inode_now(dchild->d_inode, 1);
+ if (EX_ISWSYNC(fhp->fh_export)) {
+ vfs_fsync(NULL, dchild, 0);
+ } else {
+ write_inode_now(dchild->d_inode, 1);
+ }
}

err2 = nfsd_create_setattr(rqstp, resfhp, iap);
@@ -1658,7 +1669,11 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
if (!host_err) {
if (EX_ISSYNC(ffhp->fh_export)) {
err = nfserrno(nfsd_sync_dir(ddir, 0));
- write_inode_now(dest, 1);
+ if (EX_ISWSYNC(ffhp->fh_export)) {
+ vfs_fsync(NULL, dold, 0);
+ } else {
+ write_inode_now(dest, 1);
+ }
}
err = 0;
} else {