All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cong Wang <amwang@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org,
	Stephen Hemminger <stephen@networkplumber.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [Patch net-next v5 3/3] igmp: convert RTNL lock to a spinlock
Date: Sat, 15 Jun 2013 16:44:37 +0800	[thread overview]
Message-ID: <1371285877.23997.14.camel@cr0> (raw)
In-Reply-To: <1371284768.3252.151.camel@edumazet-glaptop>

On Sat, 2013-06-15 at 01:26 -0700, Eric Dumazet wrote:
> On Sat, 2013-06-15 at 16:12 +0800, Cong Wang wrote:
> 
> > I _did_ try to replace spinlock with mutex, but apparently mutex_lock()
> > can't be called with rcu_read_lock() held, which is the case in
> > ip_mc_drop_socket().
> > 
> 
> If you hold a mutex, there is no need for rcu_read_lock() at all.
> 
> Nobody can change the lists while you are the owner.
> 
> We already have nice helpers, lockdep enabled.
> 
> check rtnl_dereference() uses
> 
> 

Oops, I should mean to say ip_mc_leave_group(), not
ip_mc_drop_socket()...

The reason why it holds RCU is to get in_dev and still uses it after
spinlock is held, but I think we can fix ip_mc_find_dev() so that we can
call it without holding RCU outside, by taking a ref to in_dev?

Thanks!

      reply	other threads:[~2013-06-15  8:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-15  7:41 [Patch net-next v5 1/3] igmp: make some functions void Cong Wang
2013-06-15  7:41 ` [Patch net-next v5 2/3] ipv6,mcast: " Cong Wang
2013-06-15  7:41 ` [Patch net-next v5 3/3] igmp: convert RTNL lock to a spinlock Cong Wang
2013-06-15  7:55   ` Eric Dumazet
2013-06-15  8:12     ` Cong Wang
2013-06-15  8:26       ` Eric Dumazet
2013-06-15  8:44         ` Cong Wang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371285877.23997.14.camel@cr0 \
    --to=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.