diff options
author | bp <bp@FreeBSD.org> | 2001-04-10 00:56:19 +0000 |
---|---|---|
committer | bp <bp@FreeBSD.org> | 2001-04-10 00:56:19 +0000 |
commit | c7aea79d8db8ddf75d4ae555af1ce491b861de3e (patch) | |
tree | fa36498dbf83e075a641f8411802550ec4799cdb | |
parent | 242556cfec5c1d6e21f25d2f6d8d81f3c6a1116d (diff) | |
download | FreeBSD-src-c7aea79d8db8ddf75d4ae555af1ce491b861de3e.zip FreeBSD-src-c7aea79d8db8ddf75d4ae555af1ce491b861de3e.tar.gz |
Avoid endless recursion on panic.
Reviewed by: jhb
-rw-r--r-- | sys/kern/subr_witness.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index aaefb2e..06ee342 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -778,8 +778,10 @@ enroll(const char *description, struct lock_class *lock_class) * This isn't quite right, as witness_cold is still 0 while we * enroll all the locks initialized before witness_initialize(). */ - if ((lock_class->lc_flags & LC_SPINLOCK) && !witness_cold) + if ((lock_class->lc_flags & LC_SPINLOCK) && !witness_cold) { + mtx_unlock_spin(&w_mtx); panic("spin lock %s not in order list", description); + } if ((w = witness_get()) == NULL) return (NULL); w->w_name = description; @@ -790,9 +792,11 @@ enroll(const char *description, struct lock_class *lock_class) STAILQ_INSERT_HEAD(&w_spin, w, w_typelist); else if (lock_class->lc_flags & LC_SLEEPLOCK) STAILQ_INSERT_HEAD(&w_sleep, w, w_typelist); - else + else { + mtx_unlock_spin(&w_mtx); panic("lock class %s is not sleep or spin", lock_class->lc_name); + } mtx_unlock_spin(&w_mtx); return (w); |