summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2016-07-16 02:55:02 +0000
committermarkj <markj@FreeBSD.org>2016-07-16 02:55:02 +0000
commit7d145474a980088b59cb6c792e8f751e3db11c90 (patch)
tree085b88e71888cfde7e94c34090b485d39b54fb14
parent1a3bbf89f0920fd3630290ab0ff451b67bd4a3a8 (diff)
downloadFreeBSD-src-7d145474a980088b59cb6c792e8f751e3db11c90.zip
FreeBSD-src-7d145474a980088b59cb6c792e8f751e3db11c90.tar.gz
MFC r302346:
Ensure that spinlock sections are balanced even after a panic.
-rw-r--r--sys/kern/kern_mutex.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index fb0b313..908f99a 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -658,8 +658,15 @@ thread_lock_flags_(struct thread *td, int opts, const char *file, int line)
i = 0;
tid = (uintptr_t)curthread;
- if (SCHEDULER_STOPPED())
+ if (SCHEDULER_STOPPED()) {
+ /*
+ * Ensure that spinlock sections are balanced even when the
+ * scheduler is stopped, since we may otherwise inadvertently
+ * re-enable interrupts while dumping core.
+ */
+ spinlock_enter();
return;
+ }
#ifdef KDTRACE_HOOKS
spin_time -= lockstat_nsecs(&td->td_lock->lock_object);
OpenPOWER on IntegriCloud