From patchwork Fri Jun 16 17:47: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: 776917 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 3wq7Cv6YHKz9s8N for ; Sat, 17 Jun 2017 03:49:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MQq/C+p9"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752535AbdFPRsb (ORCPT ); Fri, 16 Jun 2017 13:48:31 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33426 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752420AbdFPRs3 (ORCPT ); Fri, 16 Jun 2017 13:48:29 -0400 Received: by mail-pf0-f195.google.com with SMTP id w12so7568280pfk.0 for ; Fri, 16 Jun 2017 10:48:29 -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=MQq/C+p91Zg4lnTVEQ7hTlvtNhjN669ZovNxBcwdvWQBXQWBKJTqEz4t2tEK46sGoG oktzLQe9I24OhE3v7kgG4LOVjE4iigivxuUT40kDl5xa5UHo04ipZZ+r9cgxDWIymVxz b6svQM1dZwRKbIIdrctQyrY1CjcAslgBcMmPpxZ7S2hvgrmAsKnbg9idNCiGkNEdU5n+ VdrUISCwIgdct7ssBBRVApCLb9w71jYnoRA/0tTDxpUK/oeBc008tjYwljByRk9dc6DT bH70wfGKqUQxFyvcLrnI/5gdA3Bxz4QnHuoyzvacUKIB1+hACBBC+9Gjv4UfXMIHkjzY h/Wg== 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=qG1BL+kxl0TU4t9gBfkiM7Wgg7XgEdbaiTGBW/E/dq6pBA5Qx5iVemDpOkYD6YDtzE QKBpillYXUE+9LkmgOeQgPwLGjIwalKfAPcC9w/KiDsWy1hYQxhNa+Adv8e2tnHsNtTg oIFyNKetQ4q3sjsfGfteUMvimDcAwrKQIHLwzMYjYWJBqybhkXOSgP/G3Zku0C7bi9L7 q8XutRWBgTlyfCTgYTsdn3X46YjmqMYtwLSUTYLuIMVDnBpm2hsw/WyajxcPqlDndSxg CovCe/M1+p5YgfAeOyGILN6xNApHNk2Bo9NKSeEc4nIdeue8q3vLjICuGBUty1VqGJhX ujoA== X-Gm-Message-State: AKS2vOyszYnLgJXRzbX8CA0/haZgy7Hcee6PQyVWc14MEdYqBHuM3gsF ceqW4+at+7/KYw== X-Received: by 10.98.8.81 with SMTP id c78mr12352452pfd.213.1497635308868; Fri, 16 Jun 2017 10:48:28 -0700 (PDT) Received: from weiwan0.mtv.corp.google.com ([100.123.230.66]) by smtp.gmail.com with ESMTPSA id v62sm5292290pfb.124.2017.06.16.10.48.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Jun 2017 10:48:28 -0700 (PDT) From: Wei Wang To: David Miller , netdev@vger.kernel.org Cc: Eric Dumazet , Martin KaFai Lau , Wei Wang Subject: [PATCH net-next 11/21] ipv6: call dst_dev_put() properly Date: Fri, 16 Jun 2017 10:47:34 -0700 Message-Id: <20170616174744.139688-12-tracywwnj@gmail.com> X-Mailer: git-send-email 2.13.1.518.g3df882009-goog In-Reply-To: <20170616174744.139688-1-tracywwnj@gmail.com> References: <20170616174744.139688-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); }