From patchwork Mon Oct 8 09:59:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 189967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 462E72C0168 for ; Mon, 8 Oct 2012 20:59:35 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TLA7N-0006z5-E8; Mon, 08 Oct 2012 09:59:21 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TLA7L-0006yz-F8 for kernel-team@lists.ubuntu.com; Mon, 08 Oct 2012 09:59:19 +0000 Received: from p5b2e473a.dip.t-dialin.net ([91.46.71.58] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1TLA7L-0007Ct-7I for kernel-team@lists.ubuntu.com; Mon, 08 Oct 2012 09:59:19 +0000 From: Stefan Bader To: kernel-team@lists.ubuntu.com Subject: [Quantal] Fix route cache flush event Date: Mon, 8 Oct 2012 11:59:18 +0200 Message-Id: <1349690358-11609-1-git-send-email-stefan.bader@canonical.com> X-Mailer: git-send-email 1.7.9.5 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com This would fix at least the generally observable half of the problem when doing some profisioning in LXC containers. The other half looks (after most recent comments) like it could be specific to certain hardware (or at least a certain net setup). In upstream this silently was done by the followign two patches: - net: remove delay at device dismantle - net: reinstate rtnl in call_netdevice_notifiers() Both end up on removing the check on in_dev completely. And maybe the agreed stable solution will be to remove the check altogether. But for now I wanted to keep the remaining cases unmodified and just moved the NETDEV_UNREGISTER_BATCH handling in from of the check (like the NETDEV_UNREGISTER case already is). One thing is odd, though: The event handler was exactly the same back in Precise. Still my impression was that nobody had the same issue back there... still it does sound like the inet dev pointer would not be set anymore on an event that is done as one of the last steps of unregistering. -Stefan From 780d37e9d68a88ce5c21695a4be5f1dda3903c6a Mon Sep 17 00:00:00 2001 From: Stefan Bader Date: Thu, 4 Oct 2012 13:57:11 +0200 Subject: [PATCH] UBUNTU: SAUCE: net/ipv4: Always flush route cache on unregister batch call When doing (for example) a connect to an unused port on localhost in a new net namespace, it was observed that lo could not be removed immediately because there were still references on it. To release those references could take a very long time (up to five minutes). This was tracked down to an element in the route cache which was supposed to be dropped by a notify call with sending a NETDEVICE_UNREGISTER_BATCH message, but as in_dev is already unset then, the case statement never was executed. Move the handling of that notification up to be done regardless of the state of in_dev. BugLink: http://bugs.launchpad.net/bugs/1021471 Signed-off-by: Stefan Bader --- net/ipv4/fib_frontend.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 3854411..f2cabd9 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -998,6 +998,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo fib_disable_ip(dev, 2, -1); return NOTIFY_DONE; } + if (event == NETDEV_UNREGISTER_BATCH) { + /* The batch unregister is only called on the first + * device in the list of devices being unregistered. + * Therefore we should not pass dev_net(dev) in here. + */ + rt_cache_flush_batch(NULL); + return NOTIFY_DONE; + } if (!in_dev) return NOTIFY_DONE; @@ -1020,13 +1028,6 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo case NETDEV_CHANGE: rt_cache_flush(dev_net(dev), 0); break; - case NETDEV_UNREGISTER_BATCH: - /* The batch unregister is only called on the first - * device in the list of devices being unregistered. - * Therefore we should not pass dev_net(dev) in here. - */ - rt_cache_flush_batch(NULL); - break; } return NOTIFY_DONE; }