Acquiring a mtx after an sx lock

Julian Elischer julian at elischer.org
Mon Aug 18 18:38:36 UTC 2008


Julian Elischer wrote:
> Ed Maste wrote:
>> On Mon, Aug 18, 2008 at 12:02:56PM -0400, Ryan Stone wrote:
>>
>>> On Mon, Aug 18, 2008 at 11:54 AM, Max Laier <max at love2party.net> wrote:
>>>
>>>> On Monday 18 August 2008 17:14:01 Ryan Stone wrote:
>>>>> Are there any problems acquiring a sleep mutex after acquiring an sx
>>>> lock?
>>>>> man 9 locking says that you can't, but doesn't provide any reasons.
>>>> [...]
>>>>
>>>> Where does it say so?  The interaction table clearly shows: [...]
>>
>> Ahh, it seems ups' commit of rmlocks changed the "You have: sx_lock,
>> You want: Slp_mtx" case from no to ok (in r173444).
> 
> 
> hmmm
> you know, I'm not sure what the correct answer is.. I thought rw locks 
> were mutex compatible but sx locks were NOT..

Ignore me.. I was reading the table backwards.. of course if you have 
an sx you can still take out a mutex, but not visa versa.

An sx lock is considered related to a sleep. (i.e. may be long term)
and as such must not be taken out when holding a mutex, which must
not sleep.

> 
>>
>> -Ed
>> _______________________________________________
>> freebsd-hackers at freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>> To unsubscribe, send any mail to 
>> "freebsd-hackers-unsubscribe at freebsd.org"
> 
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"



More information about the freebsd-hackers mailing list