diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -97,6 +97,7 @@ #include #include #include +#include #include #include #include @@ -1136,8 +1137,11 @@ * Since spin locks include a critical section, this check * implicitly enforces a lock order of all sleep locks before * all spin locks. + * + * SCHEDULER_STOPPED() indicates that kdb is active, or it was + * and we are rebooting. */ - if (td->td_critnest != 0 && !kdb_active) + if (td->td_critnest != 0 && !SCHEDULER_STOPPED()) kassert_panic("acquiring blockable sleep lock with " "spinlock or critical section held (%s) %s @ %s:%d", class->lc_name, lock->lo_name,