--- //depot/projects/smpng/sys/nfsclient/nfs_vnops.c 2008/08/25 16:33:41 +++ //depot/user/jhb/msi/nfsclient/nfs_vnops.c 2008/09/16 19:41:13 @@ -869,7 +869,8 @@ *vpp = NULLVP; return (error); } - if ((error = cache_lookup(dvp, vpp, cnp)) && error != ENOENT) { + error = cache_lookup(dvp, vpp, cnp); + if (error == -1) { struct vattr vattr; newvp = *vpp; @@ -887,6 +888,23 @@ else vrele(newvp); *vpp = NULLVP; + } else if (error == ENOENT) { + struct vattr vattr; + + /* + * If the parent directory's change time has not + * changed since it was added to the name cache, then + * trust the negative cache entry. If the parent + * directory has changed, then purge all entries + * associated with it in the name cache. + */ + if (VOP_GETATTR(dvp, &vattr, cnp->cn_cred, td) == 0 && + vattr.va_ctime.tv_sec == VTONFS(dvp)->n_ctime) { + /* XXX: New stat? */ + nfsstats.lookupcache_hits++; + return (ENOENT); + } + cache_purge(dvp); } error = 0; newvp = NULLVP;