misc/95103: panic after mtx_destroy() on locked spinlock

Tomas Olsson tol at stacken.kth.se
Thu Mar 30 11:10:15 UTC 2006


>Number:         95103
>Category:       misc
>Synopsis:       panic after mtx_destroy() on locked spinlock
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 30 11:10:14 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Tomas Olsson
>Release:        5.5-BETA4
>Organization:
Stacken Computer Club
>Environment:
FreeBSD lab04.lab.it.su.se 5.5-BETA4 FreeBSD 5.5-BETA4 #0: Mon Mar 13 23:12:57 UTC 2006     root at perseus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
MUTEX(9) man page, under mtx_destroy() says:
    It is permissible to have a single hold count on a mutex when it is destroyed.

This does not seem to be the case when the mutex is a MTX_SPIN lock. I get a panic very soon after I call mtx_destroy() during kld unload unless the lock is released. Page fault in user mode seems to be a common panic "cause" for this.

With a MTX_DEF it appears to work according to docs.
>How-To-Repeat:
{
struct mtx lock;
mtx_init(&lock, "foo", NULL, MTX_SPIN);
mtx_lock_spin(&lock);
mtx_destroy(&lock);
}
(tried during kld unload)
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list