epoch(9): allow sx locks to be held across epoch_wait()

The INVARIANTS checks in epoch_wait() were intended to
prevent the block handler from returning with locks held.
What it in fact did was preventing anything except Giant
from being held across it. Check that the number of locks
held has not changed instead.

Approved by:	sbruno@
This commit is contained in:
Matt Macy 2018-05-14 00:14:00 +00:00
parent b9ff14e6e9
commit 0c58f85b8d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=333595

View File

@ -469,7 +469,11 @@ epoch_wait(epoch_t epoch)
int old_cpu;
int old_pinned;
u_char old_prio;
#ifdef INVARIANTS
int locks;
locks = curthread->td_locks;
#endif
INIT_CHECK(epoch);
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
@ -506,9 +510,9 @@ epoch_wait(epoch_t epoch)
/* restore thread priority */
sched_prio(td, old_prio);
thread_unlock(td);
KASSERT(td->td_locks == 0,
("%d locks held", td->td_locks));
PICKUP_GIANT();
KASSERT(td->td_locks == locks,
("%d residual locks held", td->td_locks - locks));
}
void