diff options
Diffstat (limited to 'sys/nfsclient/nfs_vnops.c')
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 7d6bb30..c74a6be 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -982,8 +982,13 @@ nfs_lookup(struct vop_lookup_args *ap) * modification time of the parent directory matches * our cached copy. Otherwise, we discard all of the * negative cache entries for this directory. + * negative cache entries for this directory. We also + * only trust -ve cache entries for less than + * nm_negative_namecache_timeout seconds. */ - if (VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && + if ((u_int)(ticks - np->n_dmtime_ticks) < + (nmp->nm_negnametimeo * hz) && + VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && vattr.va_mtime.tv_sec == np->n_dmtime) { nfsstats.lookupcache_hits++; return (ENOENT); @@ -1157,8 +1162,10 @@ nfsmout: */ mtx_lock(&np->n_mtx); if (np->n_dmtime <= dmtime) { - if (np->n_dmtime == 0) + if (np->n_dmtime == 0) { np->n_dmtime = dmtime; + np->n_dmtime_ticks = ticks; + } mtx_unlock(&np->n_mtx); cache_enter(dvp, NULL, cnp); } else |