--- "David S. Miller" <davem@redhat.com> wrote:
> From: Brad Chapman <kakadu_croc@yahoo.com>
> Date: Wed, 22 Aug 2001 11:17:55 -0700 (PDT)
>
> At this section of the code, it doesn't really matter who in the
> netfilter/network stack has BR_NETPROTO_LOCK, just that we need to know if
> it's already locked by someone else, or unlocked for us to use. Is what
> I'm
> asking for physically possible?
>
> As a reader, the BR_NETPROTO_LOCK nests. So no deadlock.
>
> If the situation involves a writer, you must make sure that locking
> rules are well defined and abided by. No matter what you do, if you
> try to conditionalize locking by testing if the lock is held, another
> SMP can always get in there after you check it and corrupt your data.
> The lock is basically pointless if you start testing it's locked
> state.
>
> Basically, "fix your code" ;-)
>
> It's often easy to do this. If you have two paths, one which is going
> to already have the lock and one which won't, just make two functions
> like so:
>
> void __func(void)
> {
> do_stuff();
> }
>
> void func(void)
> {
> lock();
> __func();
> unlock();
> }
>
> I don't see why this is such a big problem.
>
> Later,
> David S. Miller
> davem@redhat.com
Mr. Miller,
It almost isn't. The problem starts when a third-party protocol
module grabs BR_NETPROTO_LOCK, unloads itself from the networking stack,
and then tries to call ip6_conntrack_protocol_unregister(). Deadlock.
The problem is that we need TWO locks: the brlock to seal the network stack,
and the conntrack rwlock to delete the protocol struct. Sure, you can
always share the rwlock and leave it at that, but if all you need it for
is to load/unload your protocol functions, then why bother polluting
the symbol tables?
What do you think? Share the rwlock and make everybody who has
the brlock just use the core function?
Brad
=====
Brad Chapman
Permanent e-mail: kakadu_croc@yahoo.com
Current e-mail: kakadu@adelphia.net
Reply to the address I used in the message to you,
please!
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Aug 23 2001 - 21:00:50 EST