NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/46997: ufs_extattr_uepm_lock() is broken



>Number:         46997
>Category:       kern
>Synopsis:       ufs_extattr_uepm_lock() is broken
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 23 03:05:00 +0000 2012
>Originator:     matthew green
>Release:        NetBSD -current 2012-09-21
>Organization:
people's front against (bozotic) www (softwar foundation)
>Environment:
>Description:

/*
 * Per-FS attribute lock protecting attribute operations.
 * XXX Right now there is a lot of lock contention due to having a single
 * lock per-FS; really, this should be far more fine-grained.
 */
static void
ufs_extattr_uepm_lock(struct ufsmount *ump)
{

        /* XXX Why does this need to be recursive? */
        if (mutex_owned(&ump->um_extattr.uepm_lock)) {
                ump->um_extattr.uepm_lockcnt++;
                return;
        }
        mutex_enter(&ump->um_extattr.uepm_lock);
}

mutex_owned() is not usable this way.  it should never be used
for anything except asserting a mutex is held.  see mutex(9).

>How-To-Repeat:

        code-inspection.

>Fix:

        this code should be rewritten to use mutex_tryenter().



Home | Main Index | Thread Index | Old Index