๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27354

Re: [PATCH net-next 2/2] ipv6: allocate the flush serial under each table's lock

#27354
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 11:47
69 lines
10882 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] ipv6: __fib6_clean_all() bumps fib6_sernum per table,
  thrashing nexthop dsts

--

> diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
> --- a/net/ipv6/ip6_fib.c
> +++ b/net/ipv6/ip6_fib.c
> @@ -2344,8 +2347,10 @@ static void __fib6_clean_all(struct net *net,
>  		head = &net->ipv6.fib_table_hash[h];
>  		hlist_for_each_entry_rcu(table, head, tb6_hlist) {
>  			spin_lock_bh(&table->tb6_lock);
> -			fib6_clean_tree(net, &table->tb6_root,
> -					func, sernum, arg, skip_notify);
> +			if (sernum == FIB6_NEW_SERNUM)
> +				table_sn = fib6_new_sernum(net);
> +			fib6_clean_tree(net, &table->tb6_root, func,
> +					table_sn, arg, skip_notify);
>  			spin_unlock_bh(&table->tb6_lock);
>  		}
>  	}

[Severity: Medium]
This now advances net->ipv6.fib6_sernum once per table in
fib_table_hash, where before it advanced once per flush. That counter
is not only used for node stamps. rt_genid_ipv6() returns it directly,
and nexthop-backed routes (f6i->nh != NULL) record it in
pcpu_rt->sernum in ip6_rt_pcpu_alloc(). rt6_is_valid() then checks it
with exact equality.

So a single fib6_flush_trees() call can now invalidate every
nexthop-backed dst up to T times, with a full fib6_clean_tree() walk
between each bump.

A CPU that hits rt6_get_pcpu_route() during the flush can drop its
pcpu_rt with dst_dev_put() and dst_release(), then reallocate it in
rt6_make_pcpu_route(). That new dst goes stale again as soon as the
walk moves on to the next table. Likewise, ip6_dst_check() keeps
failing for connected sockets for the whole flush.

fib6_link_table() never unlinks tables, so empty tables in a VRF or
policy routing setup add to the count for the lifetime of the netns.

On a default setup with only main and local this is minor. With many
tables, though, one global invalidation turns into many.
rt_genid_bump_ipv6() is called from addrconf, fib rules, nexthop
replace and xfrm, so routine control plane events reach this path.

Could the per-table allocation be skipped for tables that have nothing
to stamp? Alternatively, fib6_flush_trees() could keep a single serial
and have fib6_clean_node() leave alone nodes that already carry a
newer one, once the age comparison lands later in the series. Either
way, it would be good to mention the effect on nexthop dsts in the
changelog.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796382778.git.ralf%40mandelbit.com
Technical Details
Message-ID: <179647124393.3146.12155290401829441082@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377959-linux-kernel-netdev=dewy.ru
References: <97a514831d146250ac95222f55ee5a9334b624d1.1796382778.git.ralf@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377959-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 2/2] ipv6: allocate the flush serial under each
 table's lock
Date: Sat, 05 Dec 2026 11:47:23 +0000
Organization: Usenet Network
Message-ID: <179647124393.3146.12155290401829441082@kernel.org>
References: <97a514831d146250ac95222f55ee5a9334b624d1.1796382778.git.ralf@mandelbit.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3017915"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:diOo8TqYXErlLuSDSaonip76kKg= sha256:QR4OO00fd8jNS2flr5kdCrUw3S1bWL8cOFL0nfPd4Vg=
	sha1:iWW/TogEhcIUDnyjRvv/awY1FMM= sha256:7RqzG7fbtGHE6nUas3ZPfXu3FSaObQ5Xa7IQy+pfq3I=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 1B817117E01; Sat,  5 Dec 2026 14:47:42 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.539
X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id UQnDVPDHBYhh;
	Sat,  5 Dec 2026 14:47:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-377959-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 9D6BB117DEE; Sat,  5 Dec 2026 14:47:30 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id BEC532D7C9; Sat,  5 Dec 2026 11:47:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796471246;
	b=mij8TYwPGE4qHq75UKOqbGAYSu0Ay0M/uwjJHnlMWJIbuLdZKsG/QH+TUldC9tpmxlkY
	 0PUizWC3OgMF4bRmiUBumOm8YuH4H0x7smuKaBvAbaxxUgPueJkeGwrS319vkVLjekf9K
	 gkAPASFSiBI9cMp/oTHq2T3IGfYrtZaYEN5yamp7ZgO9HKHu3uMEsnrhs7MwaJwhMEmhA
	 TMQfRwGLaap8CFtSrdKrr6TODNl0IfmTB8k9Ghs/rsuZuxCmuxBRtKYwZuy15atvSGuqn
	 JUnjJv5AlYcYZWY766/D0QvHSXItWe+ffcH9FnEZOX6A6FeZYjC+oyQbeJASpMrDziA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796471246;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=8O2/4ruNLaO8x9ERsO1UmXDhGDe34WMZDg8+OJHUgCo=;
	b=Y6pCd3I5TGUaDsw6VYL3F2NBeWiO7KUoiA0HSDToBmIcmgx2hChfGpyeotXbC+PlXFuh
	 BzUU5yOXNZtNzkTcrQg+i7oYbMt+J/pQlvJhT6UvFSWOV5xMJbJo4L18bFQUkGddzZjjG
	 tc/j5456V5KkgmZbiEfgrF5qZOax+ZcK6hA7H48kRcKCNcoyc7Rt/vwu0vMSxmLkU5+Gt
	 BkBZAyKAFRbP/ruJqG1bQcp2T3J+L2CNKn7bq2765JaLqXuZWVeZkh1U5lERN/HfmyiMo
	 1oNaiRcm3v5cmeYOrKGJUzPyHoOrfMNBzRaZMbh1ofwE6mnOv5H/MeZRsQ1G0Y4XYAQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nADza0wm;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 4072D606A680;
	Sat,  5 Dec 2026 11:47:26 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nADza0wm
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796471245;
	b=sEBxVUeinHV8p4IDVveirbOHCGpv7xp7Zfn6egFpy5Bq0S35s8FIRGNa0KAvGMXuHVl3
	 NtowAaCVMRSY8adZv0IiRBe4Tur5Ns+nXEjU/we7eKS1vhRuVLVqc9n1d4MW1C4eynX0T
	 2cwg+Ctj66NdHYtSE84uL2HMK0Ae6h4gsx7i40PyhduovMbs4wBFWGifIb7rGextL2P/O
	 mrZ/JYSHFPm3yezscK1e4S/6Q5Gc4Vn1DCXZm1QiVMOGalWdYow3yM9KOwQGnQdVPtfAF
	 1faINBey4uWTEdkT9048LdEz0vpGR+G2SvQe/fOWBp9e5ESO3OtHz3m4/G82GwTEUDA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796471245;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=8O2/4ruNLaO8x9ERsO1UmXDhGDe34WMZDg8+OJHUgCo=;
	b=g7RHYBw2b1BoqUaAxTpQdcKTzRbcNtqgqqS5N4VcmxCHad9pcL9w+CPits5gEgzyaBHh
	 y8+Y1udWFgU7AJQuHaNjY7ucWTx6+fFW3t0uB0x2iSG/mx7HkrytZLLJrjIBzB7oTp8p/
	 oTSxWDKrkh0nKkz+t0DgHvtZ5vqcXJr78uXgbJPy1J7hAgCNPoaKurc2CRucgPG+SScYb
	 VtLvJQvyDuqT9+AfqfSKPjB8Ad6YtmZvlEIk36HRmvLZLTTil35rAz9cJj8BDJBe60Sas
	 pP7mO+6LNWnMyY8kzlEcQTgc9KOEHzyPmsMBpC9VUwAnt2xzi3lpoEtBkqtAoPFEnUw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nADza0wm;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EBE4606A332;
	Sat,  5 Dec 2026 11:47:25 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 650FD1F00936;
	Sat,  5 Dec 2026 11:47:24 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796471245;
	bh=8O2/4ruNLaO8x9ERsO1UmXDhGDe34WMZDg8+OJHUgCo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=nADza0wmaKKJCuk4s1Amdivq8ocdTFEUC5pomd1u00KVR1XHEwOlRGJSbCeG5zamF
	 xkmZ7QTO2JaeFXKQ7AvGsegwYoTUta6+ECWzhUhB9fKzNfDBwAgZCocMxH0l+Nrz9b
	 Rl6puWXWaNnxE3EUKmXi3op4xZJuBCslx2IxW2wjAxh31IqBdvu5euz7Q/gY9ABIzt
	 s+pCET9MIryvb0YT9K4q6SeT83xQmajE1uJRgWkQlWMY2ws+YZwjbEmM8QmO1l1yvN
	 KqzKbUvN5yfe25MeiiLA5y705TitzWMYGGd9UqqnixOE2UbGmrVYiCdLsh+F9p/bGr
	 WpBWc+OFCAe0g==
X-Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 willemb@google.com, horms@kernel.org, linux-kernel@vger.kernel.org,
 antonio@mandelbit.com
X-In-Reply-To: <97a514831d146250ac95222f55ee5a9334b624d1.1796382778.git.ralf@mandelbit.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list