diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2025-11-15 02:30:34 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2025-11-15 02:30:34 +0000 |
| commit | 51931e1f0f33986296ff2860f25374cba47b860a (patch) | |
| tree | 33e432cd40d3c273467ba3cd1c0fedbf3c615bc6 | |
| parent | c490bc73eb68556bc44da9893af9be48a360de8c (diff) | |
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
| -rw-r--r-- | sys/kern/vfs_subr.c | 7 |
1 files 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); } /* |
