summaryrefslogtreecommitdiffstats
path: root/sys/fs/nullfs/null_vnops.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-01-10 18:24:48 +0000
committerkib <kib@FreeBSD.org>2013-01-10 18:24:48 +0000
commitb94d892898841866dc83f2959f8a6b759644f257 (patch)
tree6274362999c25e2da370348974c6e3af8f9b9a2a /sys/fs/nullfs/null_vnops.c
parent48d4ca6f43e841b9dc56825f68e423088aaa4dfe (diff)
downloadFreeBSD-src-b94d892898841866dc83f2959f8a6b759644f257.zip
FreeBSD-src-b94d892898841866dc83f2959f8a6b759644f257.tar.gz
When nullfs mount is forcibly unmounted and nullfs vnode is reclaimed,
get back the leased write reference from the lower vnode. There is no other path which can correct v_writecount on the lowervp. Reported by: flo Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 days
Diffstat (limited to 'sys/fs/nullfs/null_vnops.c')
-rw-r--r--sys/fs/nullfs/null_vnops.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index cc35d81..f59865f 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -740,6 +740,14 @@ null_reclaim(struct vop_reclaim_args *ap)
vp->v_object = NULL;
vp->v_vnlock = &vp->v_lock;
VI_UNLOCK(vp);
+
+ /*
+ * If we were opened for write, we leased one write reference
+ * to the lower vnode. If this is a reclamation due to the
+ * forced unmount, undo the reference now.
+ */
+ if (vp->v_writecount > 0)
+ VOP_ADD_WRITECOUNT(lowervp, -1);
vput(lowervp);
free(xp, M_NULLFSNODE);
OpenPOWER on IntegriCloud