From b5f1a9c5e77f3bfe0e6eed9fcd0cf0c458ccac64 Mon Sep 17 00:00:00 2001 From: kirill Date: Fri, 12 Jun 2026 12:20:25 +0000 Subject: [PATCH] sys/vfs: wake vclean after failed vnode lock attempts vclean() sets VXLOCK and waits for v_lockcount to drain before taking the vnode lock with LK_DRAIN. vn_lock() already woke that waiter when a racing VOP_LOCK() succeeded, noticed VXLOCK, and had to drop the lock again. Do the same wakeup when the racing VOP_LOCK() fails. A failed attempt still decrements v_lockcount, and if it was the last in flight attempt, vclean() must be notified that the drain condition is satisfied. --- sys/kern/vfs_vnops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 9cb0ecf6420..db0755bf82d 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.127 2026/04/08 12:08:25 jsg Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.128 2026/06/12 12:20:25 kirill Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -592,9 +592,9 @@ vn_lock(struct vnode *vp, int flags) */ error = ENOENT; VOP_UNLOCK(vp); - if (do_wakeup) - wakeup_one(&vp->v_lockcount); } + if (do_wakeup && xlocked) + wakeup_one(&vp->v_lockcount); } } while (flags & LK_RETRY); return (error);