diff options
author | jhb <jhb@FreeBSD.org> | 2010-07-12 14:19:23 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-07-12 14:19:23 +0000 |
commit | 5fd34398478fed7238bc99867abdee4218a87a2c (patch) | |
tree | 01814fda825c59b6122b53f0f32365010879fd96 | |
parent | 388990c1f395a1fbbe8de420f7a1c73bc2853003 (diff) | |
download | FreeBSD-src-5fd34398478fed7238bc99867abdee4218a87a2c.zip FreeBSD-src-5fd34398478fed7238bc99867abdee4218a87a2c.tar.gz |
- 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
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 163a67e..575997c 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -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); |