From patchwork Sat Jun 17 17:42:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Wang X-Patchwork-Id: 777351 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wql3M1rRCz9s76 for ; Sun, 18 Jun 2017 03:43:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UZFrCOTG"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752827AbdFQRny (ORCPT ); Sat, 17 Jun 2017 13:43:54 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35896 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752802AbdFQRnw (ORCPT ); Sat, 17 Jun 2017 13:43:52 -0400 Received: by mail-pg0-f68.google.com with SMTP id e187so1835254pgc.3 for ; Sat, 17 Jun 2017 10:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hCluxkn2eEwYMCESp1+hQlbl+lZmryaayCCdG780xZ4=; b=UZFrCOTGCmsedQVI6pslTmxUs4SGHHsfsd7e97HDtDuGKhrhAmlwl1RgE8kigXxTq1 jbknPt4vYhCMSl9bFxZ+xLfwnenK5v76baG1ACkjyapv2Cfp7sck9EXIX8gf+2pC2CpL p1luvKn/6j1HORI3AapkRp1sLFPr3g+EHiuFye6d+3Wg1nCTsv8Yv8mxmvaiPQ1J6+XX frdthjJf0UW50M6z7EZVio8F8/aXdjFVI0qdfqsw2rmKG8zSZMceINo6gIO2w+IC9OCu 574bSEj0KKe82MvtmvZu7roVYTcCdA2BiSbEWxZTkrsLwsuY5Qu3Ol4E01qsWkCTG3S2 7kTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hCluxkn2eEwYMCESp1+hQlbl+lZmryaayCCdG780xZ4=; b=LowHoKX5HxV5P/T8oXuB5swTWwzfbdGp3PSh2gB0eyRbVwX2eS4ssPvpwI/XFhSQhk bV0tO8t8pbj+P+PDY4vkbXtMDD9afotR2rrfAaBgmMMxfvmhvZfjneyvay099sVel2l0 wLuW2k2NDomVM2BkHqkU8U4u/AHwQ8Of7CSDC4CIhUYihaV48pQPPdxcLkwkTcJcOEr8 bx5e8XoslOl/bfpIRUGa3P9Iba2D1XouOq1CJr5vcqeZN3rxLiJw0CeTr6gf8SUp4uI9 cjNPOTECxyheqB5zI/P3m+1mBlM1fAAEK9u+Be31+HvmkTFqPbNcST/Oia918OqfDxLE u13Q== X-Gm-Message-State: AKS2vOwzYVIocqPSGVOTWTIYpiZk4aWJMCIha2xQBUCRCa/cRu0HbRI+ H1QFX8+hhbxPRw== X-Received: by 10.98.98.7 with SMTP id w7mr8628225pfb.99.1497721421677; Sat, 17 Jun 2017 10:43:41 -0700 (PDT) Received: from weiwan0.mtv.corp.google.com ([100.123.230.66]) by smtp.gmail.com with ESMTPSA id h7sm11352777pfc.97.2017.06.17.10.43.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 17 Jun 2017 10:43:41 -0700 (PDT) From: Wei Wang To: David Miller , netdev@vger.kernel.org Cc: Eric Dumazet , Martin KaFai Lau , Wei Wang Subject: [PATCH v2 net-next 11/21] ipv6: call dst_dev_put() properly Date: Sat, 17 Jun 2017 10:42:34 -0700 Message-Id: <20170617174244.132862-12-tracywwnj@gmail.com> X-Mailer: git-send-email 2.13.1.518.g3df882009-goog In-Reply-To: <20170617174244.132862-1-tracywwnj@gmail.com> References: <20170617174244.132862-1-tracywwnj@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Wei Wang As the intend of this patch series is to completely remove dst gc, we need to call dst_dev_put() to release the reference to dst->dev when removing routes from fib because we won't keep the gc list anymore and will lose the dst pointer right after removing the routes. Without the gc list, there is no way to find all the dst's that have dst->dev pointing to the going-down dev. Hence, we are doing dst_dev_put() immediately before we lose the last reference of the dst from the routing code. The next dst_check() will trigger a route re-lookup to find another route (if there is any). Signed-off-by: Wei Wang Acked-by: Martin KaFai Lau --- net/ipv6/ip6_fib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 3b728bcb1301..265401abb98e 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -172,6 +172,7 @@ static void rt6_free_pcpu(struct rt6_info *non_pcpu_rt) ppcpu_rt = per_cpu_ptr(non_pcpu_rt->rt6i_pcpu, cpu); pcpu_rt = *ppcpu_rt; if (pcpu_rt) { + dst_dev_put(&pcpu_rt->dst); dst_release(&pcpu_rt->dst); rt6_rcu_free(pcpu_rt); *ppcpu_rt = NULL; @@ -186,6 +187,7 @@ static void rt6_release(struct rt6_info *rt) { if (atomic_dec_and_test(&rt->rt6i_ref)) { rt6_free_pcpu(rt); + dst_dev_put(&rt->dst); dst_release(&rt->dst); rt6_rcu_free(rt); }