Subject: Re: [PATCH v2] net IPv6 : Fix broken IPv6 routing table after loopback down-up

From: "Paul E. McKenney" <[email-masked]>
Date: Thu, 28 Mar 2013 11:23:56 -0700

On Thu, Mar 28, 2013 at 06:44:25AM -0700, Eric Dumazet wrote:
> On Thu, 2013-03-28 at 18:57 +0530, Balakumaran Kannan wrote:
> > IPv6 Routing table becomes broken once we do ifdown, ifup of the loopback(lo)
> > interface. After down-up, routes of other interface's IPv6 addresses through
> > 'lo' are lost.
> > 
> 
> >  	add_addr(idev, &in6addr_loopback, 128, IFA_HOST);
> > +
> > +	/* Add routes to other interface's IPv6 addresses */
> > +	rcu_read_lock();
> > +	for_each_netdev_rcu(dev_net(dev), sp_dev) {
> > +
> 
> We hold RTNL at this point, so why use RCU at all, and adding potential
> long latencies ?
> 
> Just use for_each_netdev()
> 
> This way, a preemption is still allowed.

Agreed, there is no point in using RCU when it is not needed.

That said...

Since v3.1, in CONFIG_PREEMPT=y kernels, rcu_read_lock() does not
disable preemption.  In CONFIG_PREEMPT=n kernels, rcu_read_lock() does
disable preemption, but to no effect because preemption is already
disabled anyway.

The net effect is that rcu_read_lock() has no effect on preemption.

							Thanx, Paul

> Also, I am not sure we need ipv6_find_idev()
> 
> __in6_dev_get() should be OK.
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [email-masked]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>