git: a3ab1102e39b - main - vfs: silence a bogus LOR in freevnode

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Mon, 19 Sep 2022 02:15:16 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=a3ab1102e39b3ae1e1b1edeed995154610c6b3fd

commit a3ab1102e39b3ae1e1b1edeed995154610c6b3fd
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-09-12 23:40:22 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-09-19 02:14:50 +0000

    vfs: silence a bogus LOR in freevnode
    
    Reported by:    imp
---
 sys/kern/vfs_subr.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 2386e5a08169..a590579a25c0 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1918,7 +1918,12 @@ freevnode(struct vnode *vp)
 	mac_vnode_destroy(vp);
 #endif
 	if (vp->v_pollinfo != NULL) {
-		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+		/*
+		 * 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);
 		destroy_vpollinfo(vp->v_pollinfo);
 		VOP_UNLOCK(vp);
 		vp->v_pollinfo = NULL;