svn commit: r297837 - in head/sys/fs: nfs nfsclient
Rick Macklem
rmacklem at FreeBSD.org
Mon Apr 11 21:55:23 UTC 2016
Author: rmacklem
Date: Mon Apr 11 21:55:21 2016
New Revision: 297837
URL: https://svnweb.freebsd.org/changeset/base/297837
Log:
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.
Reported and tested by: bde
MFC after: 2 weeks
Modified:
head/sys/fs/nfs/nfsport.h
head/sys/fs/nfsclient/nfs_clrpcops.c
Modified: head/sys/fs/nfs/nfsport.h
==============================================================================
--- head/sys/fs/nfs/nfsport.h Mon Apr 11 21:15:48 2016 (r297836)
+++ head/sys/fs/nfs/nfsport.h Mon Apr 11 21:55:21 2016 (r297837)
@@ -788,12 +788,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)
Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clrpcops.c Mon Apr 11 21:15:48 2016 (r297836)
+++ head/sys/fs/nfsclient/nfs_clrpcops.c Mon Apr 11 21:55:21 2016 (r297837)
@@ -1734,7 +1734,7 @@ nfsrpc_writerpc(vnode_t vp, struct uio *
}
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;
More information about the svn-src-all
mailing list