The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=51931e1f0f33986296ff2860f25374cba47b860a
commit 51931e1f0f33986296ff2860f25374cba47b860a Author: Mark Johnston <[email protected]> AuthorDate: 2025-11-15 02:30:34 +0000 Commit: Mark Johnston <[email protected]> CommitDate: 2025-11-15 02:30:34 +0000 Revert "vnode: Rework vput() to avoid holding the vnode lock after decrementing" The change can introduce a deadlock if we release the vnode lock in order to release a reference, and then end up releasing the final reference after all, requiring a relock of the vnode. This relock may violate the usual parent->child vnode lock order. This reverts commit 99cb3dca4773fe4a16c500f9cb55fcd62cd8d7f3. Reported by: jhb --- sys/kern/vfs_subr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 9cf983f6f89d..58975f7ac932 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -3713,12 +3713,11 @@ vput(struct vnode *vp) ASSERT_VOP_LOCKED(vp, __func__); ASSERT_VI_UNLOCKED(vp, __func__); - if (refcount_release_if_last(&vp->v_usecount)) { - vput_final(vp, VPUT); + if (!refcount_release(&vp->v_usecount)) { + VOP_UNLOCK(vp); return; } - VOP_UNLOCK(vp); - vrele(vp); + vput_final(vp, VPUT); } /*
