nuno.antunes at gmail.com
Sun Dec 30 08:04:01 PST 2007
lockuninit was acquiring the spinlock embedded in struct lock, thus
incrementing the per-thread spinlock count. However, spin_uninit does
not decrement the count, resulting in a panic when trying to sleep
("lwkt_switch: still holding %d exclusive spinlocks!"). From now on,
require that the caller already holds the struct lock in question so
that lockuninit can rely on it being the sole owner of the lock.
Lots of help from: corecode@, aggelos
Comment from Aggelos: "That's what you get when commiting code without
any in-tree users."
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index c945ef5..5ae8c30 100644
@@ -518,12 +518,18 @@ lockreinit(struct lock *lkp, char *wmesg, int
timo, int flags)
+ * Requires that the caller is the exclusive owner of this lock.
lockuninit(struct lock *l)
+ * At this point we should have removed all the references to this lock
+ * so there can't be anyone waiting on it.
KKASSERT(l->lk_waitcount == 0);
- l->lk_wmesg = "BUG";
More information about the Submit