1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 07:13:36 +02:00

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.
This commit is contained in:
kirill
2026-06-12 12:20:25 +00:00
parent 23ce23157b
commit b5f1a9c5e7
+3 -3
View File
@@ -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);