From a631499072269b8f6e855f79c2ac93b74aa1a57a Mon Sep 17 00:00:00 2001 From: kan Date: Fri, 17 Apr 2009 21:18:17 +0000 Subject: [PATCH] MFC r191218 and related backout r191220. More fallout from negative dotdot caching. Negative entries should be removed from and reinserted to proper ncneg list. Reported by: pho Submitted by: kib Approved by: re (kib) git-svn-id: svn://svn.freebsd.org/base/releng/7.2@191224 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/kern/vfs_cache.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index e7b69f05..d330c5f3 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -535,18 +535,23 @@ cache_enter(dvp, vp, cnp) * to new parent vnode, otherwise continue with new * namecache entry allocation. */ - if ((ncp = dvp->v_cache_dd) != NULL) { - if (ncp->nc_flag & NCF_ISDOTDOT) { - KASSERT(ncp->nc_dvp == dvp, - ("wrong isdotdot parent")); + if ((ncp = dvp->v_cache_dd) != NULL && + ncp->nc_flag & NCF_ISDOTDOT) { + KASSERT(ncp->nc_dvp == dvp, + ("wrong isdotdot parent")); + if (ncp->nc_vp != NULL) TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst); + else + TAILQ_REMOVE(&ncneg, ncp, nc_dst); + if (vp != NULL) TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); - ncp->nc_vp = vp; - CACHE_UNLOCK(); - return; - } + else + TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); + ncp->nc_vp = vp; + CACHE_UNLOCK(); + return; } dvp->v_cache_dd = NULL; CACHE_UNLOCK(); -- 2.44.0