From a5e583eea09bfbe838558738a4f32f0a07fa522d Mon Sep 17 00:00:00 2001 From: Rick Macklem Date: Tue, 15 Nov 2011 23:35:43 +0000 Subject: [PATCH] Modify the new NFS client so that nfs_fsync() only calls ncl_flush() for regular files. Since other file types don't write into the buffer cache, calling ncl_flush() is almost a no-op. However, it does clear the NMODIFIED flag and this shouldn't be done by nfs_fsync() for directories. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clvnops.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index ee3c8d917f2..8bc0be93ac4 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -2580,6 +2580,16 @@ nfs_strategy(struct vop_strategy_args *ap) static int nfs_fsync(struct vop_fsync_args *ap) { + + if (ap->a_vp->v_type != VREG) { + /* + * For NFS, metadata is changed synchronously on the server, + * so there is nothing to flush. Also, ncl_flush() clears + * the NMODIFIED flag and that shouldn't be done here for + * directories. + */ + return (0); + } return (ncl_flush(ap->a_vp, ap->a_waitfor, NULL, ap->a_td, 1, 0)); }