Subject: Re: [Patch net-next v5 3/3] igmp: convert RTNL lock to a spinlock

From: Cong Wang <[email-masked]>
Date: Sat, 15 Jun 2013 16:44:37 +0800

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!