diff options
author | jhb <jhb@FreeBSD.org> | 2009-03-10 18:41:06 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-03-10 18:41:06 +0000 |
commit | 62fc1c4fbf1ca9d69332386a54d6aa6beaee22a0 (patch) | |
tree | d4e2bd88f8987ed429705c4cd8579d6706baa72d | |
parent | f0bf25503d9702e1e95bb364d811c1243d538b61 (diff) | |
download | FreeBSD-src-62fc1c4fbf1ca9d69332386a54d6aa6beaee22a0.zip FreeBSD-src-62fc1c4fbf1ca9d69332386a54d6aa6beaee22a0.tar.gz |
- Remove code to set SAVENAME for CREATE or RENAME requests that get a -ve
hit in the name cache. cache_lookup() doesn't actually return ENOENT
for such requests to force the filesystem to do an explicit lookup, so
this was effectively dead code.
- Grab the nfsnode mutex while writing to n_dmtime. We don't grab the lock
when comparing the time against the cached directory mod time (just as
we don't when comparing ctime's for +ve name cache hits) since the
attribute caching is already racy for NFS clients as it is.
Discussed with: bde
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 0bd103c..fd44c1a 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -923,14 +923,12 @@ nfs_lookup(struct vop_lookup_args *ap) if (VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && vattr.va_mtime.tv_sec == np->n_dmtime) { nfsstats.lookupcache_hits++; - if ((cnp->cn_nameiop == CREATE || - cnp->cn_nameiop == RENAME) && - (flags & ISLASTCN)) - cnp->cn_flags |= SAVENAME; return (ENOENT); } cache_purge_negative(dvp); + mtx_lock(&np->n_mtx); np->n_dmtime = 0; + mtx_unlock(&np->n_mtx); } error = 0; newvp = NULLVP; @@ -1041,8 +1039,10 @@ nfsmout: * name cache entry for this directory was * added. */ + mtx_lock(&np->n_mtx); if (np->n_dmtime == 0) np->n_dmtime = np->n_vattr.va_mtime.tv_sec; + mtx_unlock(&np->n_mtx); cache_enter(dvp, NULL, cnp); } return (ENOENT); |