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.
This commit is contained in:
Mateusz Guzik 2022-09-14 23:04:22 +00:00
parent ad5e1f9c2d
commit 43fbd0e7a7

View File

@ -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),