From 8bd567c2ae2ac4f74563732817cb15ce08f8a9e5 Mon Sep 17 00:00:00 2001 From: avg Date: Mon, 30 Jan 2017 15:20:13 +0000 Subject: [PATCH] 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 --- sys/kern/kern_lockf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c index 1972b8270900..654e927ba932 100644 --- a/sys/kern/kern_lockf.c +++ b/sys/kern/kern_lockf.c @@ -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