Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Mar 2006 11:06:31 GMT
From:      Tomas Olsson <tol@stacken.kth.se>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/95103: panic after mtx_destroy() on locked spinlock
Message-ID:  <200603301106.k2UB6VTC019683@www.freebsd.org>
Resent-Message-ID: <200603301110.k2UBAEF0059266@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603301106.k2UB6VTC019683>