summaryrefslogtreecommitdiffstats
path: root/sys/fs/nullfs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-05-21 11:31:56 +0000
committerkib <kib@FreeBSD.org>2013-05-21 11:31:56 +0000
commite68d3a11b7e0873437e0c75a7a936aa2cf260ac9 (patch)
treec0eb0e65c450eea3396dac831804c8454c477a8f /sys/fs/nullfs
parentb2b2f0b7824de13c4ff93c389bf00cfa0a78cb38 (diff)
downloadFreeBSD-src-e68d3a11b7e0873437e0c75a7a936aa2cf260ac9.zip
FreeBSD-src-e68d3a11b7e0873437e0c75a7a936aa2cf260ac9.tar.gz
Do not leak the NULLV_NOUNLOCK flag from the nullfs_unlink_lowervp(),
for the case when the nullfs vnode is not reclaimed. Otherwise, later reclamation would not unlock the lower vnode. Reported by: antoine Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
Diffstat (limited to 'sys/fs/nullfs')
-rw-r--r--sys/fs/nullfs/null_vfsops.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index ad02236..80824a5 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -409,16 +409,28 @@ nullfs_unlink_lowervp(struct mount *mp, struct vnode *lowervp)
vhold(vp);
vunref(vp);
- /*
- * If vunref() dropped the last use reference on the nullfs
- * vnode, it must be reclaimed, and its lock was split from
- * the lower vnode lock. Need to do extra unlock before
- * allowing the final vdrop() to free the vnode.
- */
if (vp->v_usecount == 0) {
+ /*
+ * If vunref() dropped the last use reference on the
+ * nullfs vnode, it must be reclaimed, and its lock
+ * was split from the lower vnode lock. Need to do
+ * extra unlock before allowing the final vdrop() to
+ * free the vnode.
+ */
KASSERT((vp->v_iflag & VI_DOOMED) != 0,
- ("not reclaimed %p", vp));
+ ("not reclaimed nullfs vnode %p", vp));
VOP_UNLOCK(vp, 0);
+ } else {
+ /*
+ * Otherwise, the nullfs vnode still shares the lock
+ * with the lower vnode, and must not be unlocked.
+ * Also clear the NULLV_NOUNLOCK, the flag is not
+ * relevant for future reclamations.
+ */
+ ASSERT_VOP_ELOCKED(vp, "unlink_lowervp");
+ KASSERT((vp->v_iflag & VI_DOOMED) == 0,
+ ("reclaimed nullfs vnode %p", vp));
+ xp->null_flags &= ~NULLV_NOUNLOCK;
}
vdrop(vp);
}
OpenPOWER on IntegriCloud