lkml.org 
[lkml]   [2008]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock()
Nick Piggin wrote:
>
>> This can be a source of bugs, where people might notice an outer lock
>> being released and think the inner locks were too.
>>
>> Lately the kernel has been going through a lot of clean ups that have
>> been making the kernel a much more maintainable beast. I feel we should
>> enforce the rule of unlocking order (again, unless there is a good
>> reason not to). Not for a technical reason, but just for a more
>> maintainable one.
>>
>
> I don't really think it would make things more maintainable, FWIW.
>

I actually did come across one bug in my lifetime where the out of
nesting order
of unlocks caused a bug. IIRC, it had to do (as Linus mentioned) with
lots of
little functions that required locking. One of these functions was
between the
out of order unlocking and was taking another inner lock.

I don't remember the exact details, but it was something that made me
try to nest
locks and unlocks nicely when possible. And as Linus pointed out, there
are several
cases where it just doesn't make sense to nest.

-- Steve



\
 
 \ /
  Last update: 2008-10-08 19:21    [W:0.075 / U:1.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site