git: 3f63d59e38cd - stable/14 - vnode: Assert that VOP_LOCK succeeds in freevnode()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 21 Sep 2025 14:52:57 UTC
The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3f63d59e38cd643b8aedf37e706c50fe7fa494b3 commit 3f63d59e38cd643b8aedf37e706c50fe7fa494b3 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-08-30 14:56:58 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-09-21 14:52:38 +0000 vnode: Assert that VOP_LOCK succeeds in freevnode() Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D52245 (cherry picked from commit a7aac8c20497d1666a15f160ef99acddd55a1365) --- sys/kern/vfs_subr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index c0322593dead..aa02b54c3260 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2159,6 +2159,8 @@ freevnode(struct vnode *vp) { struct bufobj *bo; + ASSERT_VOP_UNLOCKED(vp, __func__); + /* * The vnode has been marked for destruction, so free it. * @@ -2197,12 +2199,16 @@ freevnode(struct vnode *vp) mac_vnode_destroy(vp); #endif if (vp->v_pollinfo != NULL) { + int error __diagused; + /* * Use LK_NOWAIT to shut up witness about the lock. We may get * here while having another vnode locked when trying to * satisfy a lookup and needing to recycle. */ - VOP_LOCK(vp, LK_EXCLUSIVE | LK_NOWAIT); + error = VOP_LOCK(vp, LK_EXCLUSIVE | LK_NOWAIT); + VNASSERT(error == 0, vp, + ("freevnode: cannot lock vp %p for pollinfo destroy", vp)); destroy_vpollinfo(vp->v_pollinfo); VOP_UNLOCK(vp); vp->v_pollinfo = NULL;