[lkml]   [2001]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: brlock_is_locked()?
--- "David S. Miller" <> wrote:
> From: Brad Chapman <>
> 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

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
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?



Brad Chapman

Permanent e-mail:
Current e-mail:

Reply to the address I used in the message to you,

Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
 \ /
  Last update: 2005-03-22 12:57    [W:0.066 / U:0.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site