summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2006-01-08 00:18:34 +0000
committerscottl <scottl@FreeBSD.org>2006-01-08 00:18:34 +0000
commit5e21ed37ae6579b7490f6d6e4cb61a2738137914 (patch)
tree4bc0e31ae985354f21de9fe8e1db760d2b158dcf /sys
parent62a303f1e1f438d456ebe73b252a83c17de02ed5 (diff)
downloadFreeBSD-src-5e21ed37ae6579b7490f6d6e4cb61a2738137914.zip
FreeBSD-src-5e21ed37ae6579b7490f6d6e4cb61a2738137914.tar.gz
If destroying a spinlock, make sure that it is exited properly.
Submitted by: jhb MFC After: 3 days
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_mutex.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 81addbe..f06813a 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -883,6 +883,10 @@ mtx_destroy(struct mtx *m)
else {
MPASS((m->mtx_lock & (MTX_RECURSED|MTX_CONTESTED)) == 0);
+ /* Perform the non-mtx related part of mtx_unlock_spin(). */
+ if (LO_CLASSINDEX(&m->mtx_object) == LOCK_CLASS_SPIN_MUTEX)
+ spinlock_exit();
+
/* Tell witness this isn't locked to make it happy. */
WITNESS_UNLOCK(&m->mtx_object, LOP_EXCLUSIVE, __FILE__,
__LINE__);
OpenPOWER on IntegriCloud