From 43fbd0e7a74b75c18e9fc76f371bd85edf6bb0b4 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Wed, 14 Sep 2022 23:04:22 +0000 Subject: [PATCH] lockf: elide vnode interlock in the common case in lf_purgelocks The interlock was already taken and released when dooming, thus by API contract locking state cannot be legally installed. At the same time the state is almost never there to begin with. --- sys/kern/kern_lockf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c index 98e29b2c9292..171a0a861c6d 100644 --- a/sys/kern/kern_lockf.c +++ b/sys/kern/kern_lockf.c @@ -764,14 +764,13 @@ lf_purgelocks(struct vnode *vp, struct lockf **statep) * sleeping waiting for locks on this vnode and then free all * the remaining locks. */ - VI_LOCK(vp); KASSERT(VN_IS_DOOMED(vp), ("lf_purgelocks: vp %p has not vgone yet", vp)); state = *statep; if (state == NULL) { - VI_UNLOCK(vp); return; } + VI_LOCK(vp); *statep = NULL; if (LIST_EMPTY(&state->ls_active) && state->ls_threads == 0) { KASSERT(LIST_EMPTY(&state->ls_pending),