Re: brlock_is_locked()?

From: Brad Chapman (kakadu_croc@yahoo.com)
Date: Wed Aug 22 2001 - 13:17:55 EST


--- "David S. Miller" <davem@redhat.com> wrote:
> From: Brad Chapman <kakadu_croc@yahoo.com>
> Date: Wed, 22 Aug 2001 11:00:56 -0700 (PDT)
>
> I'm not talking about _who_ owns the lock, I'm talking about whether
> the lock itself is locked. I don't care which process is using the lock;
> I just want to know if _somebody_ is using it. Is this possible?
>
> Show a valid use for such a boolean state, then
> the discussion may proceed :-)
>
> Later,
> David S. Miller
> davem@redhat.com

Mr. Miller,

        I am debugging my port of the Netfilter IPv4 connection tracking
subsystem to IPv6. In some sections of the code, I had to split the code
into core functions, which did the actual work and could be used by people
with the appropriate locks, and wrapper functions, which grabbed the locks
themselves.
        One such group of functions was the ip6_conntrack_protocol API.
To make life easier in the future, and to make third-party protocol
registration easier, I split the functions. In the unregistration function,
in order to be SMP-compliant we needed to grab BR_NETPROTO_LOCK to seal
the netfilter stack and prevent any packets from being scanned by the protocol
functions. When I split the unregistration function, I realized that there
was no way to detect if BR_NETPROTO_LOCK was locked, by _anyone_. Thus, if
someone had BR_NETPROTO_LOCK and tried to call
ip6_conntrack_protocol_unregister() (the wrapper), we would deadlock.
        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?

Thanks,

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