On Mon, Apr 24, 2017 at 01:37:00PM -0600, David Ahern wrote: > On 4/24/17 10:39 AM, Eric Dumazet wrote: > > > > Very nice changelog ! > > > Thanks. Given my aggressive brain cell recycling program, I needed to > write down the analysis. > > > > >> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c > >> index 80ce478c4851..93f81d9cd85f 100644 > >> --- a/net/ipv6/addrconf.c > >> +++ b/net/ipv6/addrconf.c > >> @@ -3271,14 +3271,25 @@ static void addrconf_gre_config(struct net_device > >> *dev) > >> static int fixup_permanent_addr(struct inet6_dev *idev, > >> struct inet6_ifaddr *ifp) > >> { > >> - if (!ifp->rt) { > >> - struct rt6_info *rt; > >> + /* rt6i_ref == 0 means the host route was removed from the > >> + * FIB, for example, if 'lo' device is taken down. In that > >> + * case regenerate the host route. > >> + */ > >> + if (!ifp->rt || !atomic_read(&ifp->rt->rt6i_ref)) { > >> + struct rt6_info *rt, *prev; > >> > >> rt = addrconf_dst_alloc(idev, &ifp->addr, false); > >> if (unlikely(IS_ERR(rt))) > >> return PTR_ERR(rt); > >> > >> + prev = ifp->rt; > > > > I would feel more comfortable if this was moved after the spin_lock() ? > > That's what I had in v2; it reads better to me even if it is not > technically required (all changes to ifp->rt happen under rtnl). > > Martin you agree? Agree.
My question was mainly on the added spin_lock. > > I'll send a v3 tomorrow -- allow more time for other comments.