From 1feb7a6efa0c676a7f2d4916babe126ff7720317 Mon Sep 17 00:00:00 2001 From: Ian Dowse Date: Fri, 11 May 2001 20:42:41 +0000 Subject: [PATCH] In vrele() and vput(), avoid triggering the confusing "missed vn_close" KASSERT when vp->v_usecount is zero or negative. In this case, the "v*: negative ref cnt" panic that follows is much more appropriate. Reviewed by: mckusick --- sys/kern/vfs_subr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 17d4089e9c4e..cf2ea29349e3 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1508,7 +1508,9 @@ vrele(vp) mtx_lock(&vp->v_interlock); - KASSERT(vp->v_writecount < vp->v_usecount, ("vrele: missed vn_close")); + /* Skip this v_writecount check if we're going to panic below. */ + KASSERT(vp->v_writecount < vp->v_usecount || vp->v_usecount < 1, + ("vrele: missed vn_close")); if (vp->v_usecount > 1) { @@ -1554,7 +1556,9 @@ vput(vp) KASSERT(vp != NULL, ("vput: null vp")); mtx_lock(&vp->v_interlock); - KASSERT(vp->v_writecount < vp->v_usecount, ("vput: missed vn_close")); + /* Skip this v_writecount check if we're going to panic below. */ + KASSERT(vp->v_writecount < vp->v_usecount || vp->v_usecount < 1, + ("vput: missed vn_close")); if (vp->v_usecount > 1) {