netdev
[Top] [All Lists]

Re: [PATCH] tiny af_packet.c cleanup

To: Francois Romieu <romieu@xxxxxxxxxxxxx>
Subject: Re: [PATCH] tiny af_packet.c cleanup
From: Mitchell Blank Jr <mitch@xxxxxxxxxx>
Date: Sat, 13 Sep 2003 13:15:59 -0700
Cc: netdev@xxxxxxxxxxx
In-reply-to: <20030913110353.B23840@xxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20030913055033.GB94744@xxxxxxxxxxxxxx> <20030913093559.A23840@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20030913080252.GE94744@xxxxxxxxxxxxxx> <20030913110353.B23840@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.1i
Francois Romieu wrote:
> Actually packet_rcv() is run in a BH context and doesn't race with
> SO_{ATTACH/DETACH}_FILTER from sock_setsockopt() which does the
> appropriate BH locking (spin_lock_bh(&sk->sk_lock.slock) in
> net/core/sock.c::sock_setsockopt and in net/core/filter.c::sk_attach_filter).
> packet_rcv() doesn't race with BH either due to the bh_lock_sock (a spin_lock
> in disguise) you quoted.

I don't understand what you're saying - are you saying that the locking
isn't needed?  Or just the recheck isn't needed?  It sounds like if we're
only avoiding the race because of the bh_lock_sock() then we do need to
recheck, right?

Could you do a patch for what you think it should look like?  You obviously
understand the locking issues here better than I.

-Mitch

<Prev in Thread] Current Thread [Next in Thread>