summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_cache.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 88ecc35..4dfbe93 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -493,8 +493,18 @@ cache_enter(dvp, vp, cnp)
if (cnp->cn_namelen == 1) {
return;
}
+ /*
+ * For dotdot lookups only cache the v_dd pointer if the
+ * directory has a link back to its parent via v_cache_dst.
+ * Without this an unlinked directory would keep a soft
+ * reference to its parent which could not be NULLd at
+ * cache_purge() time.
+ */
if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') {
- dvp->v_dd = vp;
+ CACHE_LOCK();
+ if (!TAILQ_EMPTY(&dvp->v_cache_dst))
+ dvp->v_dd = vp;
+ CACHE_UNLOCK();
return;
}
}
OpenPOWER on IntegriCloud