Messages in this thread | | | Date | Wed, 08 Oct 2008 13:18:45 -0400 | From | Steven Rostedt <> | Subject | Re: [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
| |