put very expensive sanity checks of advisory locks under DIAGNOSTIC

The checks have quadratic complexity over a number of advisory locks
active for a file and that could be a lot.  What's the worse is that the
checks are done while holding ls_lock.  That could lead to a long a very
long backlog and performance degradation even if all requested locks are
compatible (e.g. all shared locks).

The checks used to be under INVARIANTS.

Discussed with:	kib
MFC after:	2 weeks
Sponsored by:	Panzura
This commit is contained in:
avg 2017-01-30 15:20:13 +00:00
parent a546306498
commit 8bd567c2ae

View File

@ -689,7 +689,7 @@ lf_advlockasync(struct vop_advlockasync_args *ap, struct lockf **statep,
break;
}
#ifdef INVARIANTS
#ifdef DIAGNOSTIC
/*
* Check for some can't happen stuff. In this case, the active
* lock list becoming disordered or containing mutually
@ -917,7 +917,7 @@ lf_add_edge(struct lockf_entry *x, struct lockf_entry *y)
struct lockf_edge *e;
int error;
#ifdef INVARIANTS
#ifdef DIAGNOSTIC
LIST_FOREACH(e, &x->lf_outedges, le_outlink)
KASSERT(e->le_to != y, ("adding lock edge twice"));
#endif