Re: [PATCH] netfilter: use per-cpu recursive lock (v13)

Linus Torvalds
2009-04-22T15:43:23Z

On Tue, 21 Apr 2009, Stephen Hemminger wrote:
>
> This version of x_tables (ip/ip6/arp) locking uses a per-cpu
> recursive lock that can be nested.

Ack on the code.

But the comment is _still_ crap. Please update. It's not a recursive lock,
as clearly shown by the code itself. It's a per-cpu read-write lock, and
only the reader is "recursive" (but that's how read-write locks with in
Linux, and that has nothing to do with anything).

So make the explanations match the code and the intent. Write it something
like

This version of x_tables (ip/ip6/arp) locking uses a per-cpu
reader-writer lock lock where the readers can nest.

and don't confuse it with incorrect commit messages. The lock is very much
not recursive - on purpose - for half the people taking it.

[ That, btw, was always true, even in the original random open-coded
version. Because you can't actually do a real recursive lock without
having notion of "current ownership" either by making the count be
<per-thread,per-lock> - like the BKL - or by saving the ownership
information in the lock. A plain counter simply doesn't do it. ]

Linus