From patchwork Fri May 2 14:15:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris J Arges X-Patchwork-Id: 344985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 070A814010C; Sat, 3 May 2014 00:16:12 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1WgEG0-0003Wh-Pj; Fri, 02 May 2014 14:16:08 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1WgEFp-0003To-Az for kernel-team@lists.ubuntu.com; Fri, 02 May 2014 14:15:57 +0000 Received: from cpe-66-68-155-223.austin.res.rr.com ([66.68.155.223] helo=macgyver.austin.rr.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1WgEFp-00045f-1F for kernel-team@lists.ubuntu.com; Fri, 02 May 2014 14:15:57 +0000 From: Chris J Arges To: kernel-team@lists.ubuntu.com Subject: [PATCH] UBUNTU: SAUCE: net/ipv4: Always flush route cache on unregister batch call Date: Fri, 2 May 2014 09:15:50 -0500 Message-Id: <1399040150-11863-2-git-send-email-chris.j.arges@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1399040150-11863-1-git-send-email-chris.j.arges@canonical.com> References: <1399040150-11863-1-git-send-email-chris.j.arges@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Stefan Bader 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 Signed-off-by: Tim Gardner Signed-off-by: Chris J Arges Acked-by: Andy Whitcroft --- 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 92fc5f6..5085d48 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -999,6 +999,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; @@ -1021,13 +1029,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; }