Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751703AbdHMXIH (ORCPT ); Sun, 13 Aug 2017 19:08:07 -0400 Received: from mail-pg0-f43.google.com ([74.125.83.43]:37159 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750867AbdHMXIE (ORCPT ); Sun, 13 Aug 2017 19:08:04 -0400 Subject: Re: unregister_netdevice: waiting for eth0 to become free. Usage count = 1 To: Wei Wang References: <20170812180129.GA31700@splinter> <61d95fe2-edfd-9fc4-5e21-5b96e4e03c9f@gmail.com> Cc: Ido Schimmel , Cong Wang , John Stultz , Martin KaFai Lau , lkml , Network Development , Linux USB List , "David S. Miller" , Felipe Balbi From: David Ahern Message-ID: <5a4e7562-49f7-a91f-5776-5a0efe9161c7@gmail.com> Date: Sun, 13 Aug 2017 17:08:03 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1276 Lines: 28 On 8/13/17 2:56 PM, Wei Wang wrote: >> Looking at my patch to move host routes from loopback to device with the >> address, I have this: >> >> @@ -2789,7 +2808,8 @@ static int fib6_ifdown(struct rt6_info *rt, void *arg) >> const struct arg_dev_net *adn = arg; >> const struct net_device *dev = adn->dev; >> >> - if ((rt->dst.dev == dev || !dev) && >> + if ((rt->dst.dev == dev || !dev || >> + (netdev_unregistering(dev) && rt->rt6i_idev->dev == dev)) && >> rt != adn->net->ipv6.ip6_null_entry && >> (rt->rt6i_nsiblings == 0 || >> (dev && netdev_unregistering(dev)) || > > As you explained earlier, after your patch, all entries in the fib6 > tree will have rt->dst.dev be the same as rt->rt6i_idev->dev except > those ones created by p6_rt_cache_alloc() and ip6_rt_pcpu_alloc(). > Then the above newly added check is mainly to catch those cached dst > entries (created by ip6_rt_cached_alloc()). right? > And it is required because __ipv6_ifa_notify() -> ip6_del_rt() won't > take care of those cached dst entries. > > Then I think I should wait for your patches to get merged before > submitting my patch? no. your patch will need to go back to 4.12; my changes will not be appropriate for that.