Module Name: src Committed By: hannken Date: Mon Feb 28 08:44:04 UTC 2022
Modified Files: src/sys/kern: vfs_vnode.c Log Message: vrelel(): no VOP_UNLOCK() with v_interlock or vmobjlock held. To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.133 src/sys/kern/vfs_vnode.c:1.134 --- src/sys/kern/vfs_vnode.c:1.133 Thu Feb 17 14:39:51 2022 +++ src/sys/kern/vfs_vnode.c Mon Feb 28 08:44:04 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnode.c,v 1.133 2022/02/17 14:39:51 hannken Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.134 2022/02/28 08:44:04 hannken Exp $ */ /*- * Copyright (c) 1997-2011, 2019, 2020 The NetBSD Foundation, Inc. @@ -148,7 +148,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.133 2022/02/17 14:39:51 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.134 2022/02/28 08:44:04 hannken Exp $"); #ifdef _KERNEL_OPT #include "opt_pax.h" @@ -801,16 +801,16 @@ retry: */ for (use = atomic_load_relaxed(&vp->v_usecount);; use = next) { if (__predict_false((use & VUSECOUNT_MASK) > 1)) { + if (objlock_held) { + objlock_held = false; + rw_exit(vp->v_uobj.vmobjlock); + } if (lktype != LK_NONE) { mutex_exit(vp->v_interlock); lktype = LK_NONE; VOP_UNLOCK(vp); mutex_enter(vp->v_interlock); } - if (objlock_held) { - objlock_held = false; - rw_exit(vp->v_uobj.vmobjlock); - } if (vtryrele(vp)) { mutex_exit(vp->v_interlock); return; @@ -843,6 +843,10 @@ retry: * deactivate this node. */ if (VSTATE_GET(vp) == VS_RECLAIMED) { + if (objlock_held) { + objlock_held = false; + rw_exit(vp->v_uobj.vmobjlock); + } if (lktype != LK_NONE) { mutex_exit(vp->v_interlock); lktype = LK_NONE; @@ -884,7 +888,9 @@ retry: * clean it here. We donate it our last reference. */ if (lktype != LK_NONE) { + mutex_exit(vp->v_interlock); VOP_UNLOCK(vp); + mutex_enter(vp->v_interlock); } lru_requeue(vp, &lru_list[LRU_VRELE]); mutex_exit(vp->v_interlock);