svn commit: r209946 - head/sys/nfsclient

John Baldwin jhb at FreeBSD.org
Mon Jul 12 14:19:24 UTC 2010


Author: jhb
Date: Mon Jul 12 14:19:23 2010
New Revision: 209946
URL: http://svn.freebsd.org/changeset/base/209946

Log:
  - Add missing locking around flushing of an NFS node's attribute cache
    in the NMODIFIED case of nfs_open().
  - Cosmetic tweak to simplify an expression in nfs_lookup().
  
  Reviewed by:	rmacklem, bde
  MFC after:	1 week

Modified:
  head/sys/nfsclient/nfs_vnops.c

Modified: head/sys/nfsclient/nfs_vnops.c
==============================================================================
--- head/sys/nfsclient/nfs_vnops.c	Mon Jul 12 13:38:26 2010	(r209945)
+++ head/sys/nfsclient/nfs_vnops.c	Mon Jul 12 14:19:23 2010	(r209946)
@@ -525,10 +525,12 @@ nfs_open(struct vop_open_args *ap)
 		error = nfs_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
 		if (error == EINTR || error == EIO)
 			return (error);
+		mtx_lock(&np->n_mtx);
 		np->n_attrstamp = 0;
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
 		if (vp->v_type == VDIR)
 			np->n_direofoffset = 0;
+		mtx_unlock(&np->n_mtx);
 		error = VOP_GETATTR(vp, &vattr, ap->a_cred);
 		if (error)
 			return (error);
@@ -970,8 +972,8 @@ nfs_lookup(struct vop_lookup_args *ap)
 		 */
 		newvp = *vpp;
 		newnp = VTONFS(newvp);
-		if ((cnp->cn_flags & (ISLASTCN | ISOPEN)) ==
-		    (ISLASTCN | ISOPEN) && !(newnp->n_flag & NMODIFIED)) {
+		if ((flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) &&
+		    !(newnp->n_flag & NMODIFIED)) {
 			mtx_lock(&newnp->n_mtx);
 			newnp->n_attrstamp = 0;
 			KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(newvp);


More information about the svn-src-all mailing list