Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock()

From: Steven Rostedt
Date: Wed Oct 08 2008 - 13:19:33 EST


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/