aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-05-28 09:42:38 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-06-14 02:02:38 +0000
commit36b155a2b3baa747c1968a9094df9fa7fb0d02b3 (patch)
treedf74cf16e5a2778e17b85288d3aba77a2347d7f8 /sys
parent3eafe0188410dcccb21c28a4c2e8f19c68861c76 (diff)
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_subr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 65529bc195bb..7b2718269a1f 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1936,9 +1936,14 @@ vtryrecycle(struct vnode *vp, bool isvnlru)
* anyone picked up this vnode from another list. If not, we will
* mark it with DOOMED via vgonel() so that anyone who does find it
* will skip over it.
+ *
+ * We cannot check only for v_usecount > 0 there, since
+ * v_usecount increment is lockless. Instead check for
+ * v_holdcnt > 1, with the side effect that a parallel vhold()
+ * also aborts freeing this vnode.
*/
VI_LOCK(vp);
- if (vp->v_usecount) {
+ if (vp->v_holdcnt > 1) {
VOP_UNLOCK(vp);
vdropl_recycle(vp);
vn_finished_write(vnmp);