Fix lockuninit.
authorSimon Schubert <corecode@dragonflybsd.org>
Wed, 9 Jan 2008 10:59:12 +0000 (10:59 +0000)
committerSimon Schubert <corecode@dragonflybsd.org>
Wed, 9 Jan 2008 10:59:12 +0000 (10:59 +0000)
commit0412a3334ce8f2ed3731a0f6550f0db21c14354d
tree9383c438698c2a48eca33a0fa7de2232007a9516
parentef6a9c01746cd2a6a86f643f669ce1823f32a9b0
Fix lockuninit.

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."

Submitted-by: nant@
sys/kern/kern_lock.c