summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2016-05-06 23:44:24 +0000
committerrmacklem <rmacklem@FreeBSD.org>2016-05-06 23:44:24 +0000
commit45f14820b0ec21c50e7647c5dfde71d497adade8 (patch)
tree3592e4e36007bf736cb267ad71b631cca20c3fae /sys/fs
parent00649b2ea81b97c73999ace6219ec79a366790a2 (diff)
downloadFreeBSD-src-45f14820b0ec21c50e7647c5dfde71d497adade8.zip
FreeBSD-src-45f14820b0ec21c50e7647c5dfde71d497adade8.tar.gz
MFC: r297837
Bruce Evans reported that there was a performance regression between the old and new NFS clients. He did a good job of isolating the problem which was caused by the new NFS client not setting the post write mtime correctly. The new NFS client code was cloned from the old client, but was incorrect, because the mtime in the nfs vnode's cache wasn't yet updated. This patch fixes this problem. The patch also adds missing mutex locking.
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nfs/nfsport.h8
-rw-r--r--sys/fs/nfsclient/nfs_clrpcops.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h
index eea9df0..1e0c0ba 100644
--- a/sys/fs/nfs/nfsport.h
+++ b/sys/fs/nfs/nfsport.h
@@ -787,12 +787,14 @@ MALLOC_DECLARE(M_NEWNFSDSESSION);
/*
* Set the n_time in the client write rpc, as required.
*/
-#define NFSWRITERPC_SETTIME(w, n, v4) \
+#define NFSWRITERPC_SETTIME(w, n, a, v4) \
do { \
if (w) { \
- (n)->n_mtime = (n)->n_vattr.na_vattr.va_mtime; \
+ mtx_lock(&((n)->n_mtx)); \
+ (n)->n_mtime = (a)->na_mtime; \
if (v4) \
- (n)->n_change = (n)->n_vattr.na_vattr.va_filerev; \
+ (n)->n_change = (a)->na_filerev; \
+ mtx_unlock(&((n)->n_mtx)); \
} \
} while (0)
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 429cfcc..642d184 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -1731,7 +1731,7 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iomode,
}
if (error)
goto nfsmout;
- NFSWRITERPC_SETTIME(wccflag, np, (nd->nd_flag & ND_NFSV4));
+ NFSWRITERPC_SETTIME(wccflag, np, nap, (nd->nd_flag & ND_NFSV4));
mbuf_freem(nd->nd_mrep);
nd->nd_mrep = NULL;
tsiz -= len;
OpenPOWER on IntegriCloud