From: netdev-bot+sashiko@kernel.org
To: ralf@mandelbit.com
Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, ncardwell@google.com,
kuniyu@google.com, steffen.klassert@secunet.com,
herbert@gondor.apana.org.au, fw@strlen.de, sd@queasysnail.net,
antonio@mandelbit.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 1/3] ipv6: stamp the default route node with a fresh serial on link failure
Date: Thu, 19 Nov 2026 09:22:53 +0000 [thread overview]
Message-ID: <179508017302.3136.6673661223156092826@kernel.org> (raw)
In-Reply-To: <5b59512a6c51c7a5d7c7b4e16728de3c522d9a1e.1794906743.git.ralf@mandelbit.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] ip6_link_failure() (net/ipv6/route.c) used to do one idempotent
store, WRITE_ONCE(fn->fn_sernum, -1).
- [Low] The patch reuses rt6_exception_net() in ip6_link_failure() for a
dst that is not an exception (the !RTF_CACHE, RTF_DEFAULT branch).
--
ipv6: stamp the default route node with a fresh serial on link failure
For a non-cached RTF_DEFAULT dst, ip6_link_failure() used to write -1
into fn_sernum. With this patch it takes tb6_lock and calls
fib6_update_sernum() instead. That stamps the node with a fresh serial and
advances net->ipv6.fib6_sernum, so the lookup-cookie checks added later in
the series can tell repeated invalidations apart.
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 4a4c5ace63c54..cc505817399ba 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -2873,13 +2873,13 @@ static void ip6_link_failure(struct sk_buff *skb)
> rt6_remove_exception_rt(rt);
> } else {
> struct fib6_info *from;
> - struct fib6_node *fn;
>
> from = rcu_dereference(rt->from);
> - if (from) {
> - fn = rcu_dereference(from->fib6_node);
> - if (fn && (rt->rt6i_flags & RTF_DEFAULT))
> - WRITE_ONCE(fn->fn_sernum, -1);
> + if (from && from->fib6_table &&
> + (rt->rt6i_flags & RTF_DEFAULT)) {
> + spin_lock_bh(&from->fib6_table->tb6_lock);
> + fib6_update_sernum(rt6_exception_net(rt), from);
> + spin_unlock_bh(&from->fib6_table->tb6_lock);
[Severity: Low]
The old code did a single store that gave the same result every time.
The new code takes the table-wide tb6_lock and advances the netns-wide
net->ipv6.fib6_sernum on every call. ip6_link_failure() runs once per
skb, not once per event.
Is that per-skb cost intended on these paths?
For example, neigh_invalidate()->ndisc_error_report() calls
dst_link_failure() for every skb queued on the default router's
arp_queue:
net/ipv6/ndisc.c:ndisc_error_report() {
...
dst_link_failure(skb);
...
}
The err_count paths in ip6_tnl_xmit() and ipip6_tunnel_xmit() also reach
this code, at one link failure per received ICMP error. These are 1:1, so
they don't amplify anything. The sit path can't be reached for ISATAP,
because ipip6_err() returns before incrementing err_count when
parms->iph.daddr == 0.
Each bump goes through fib6_new_sernum():
} while (!atomic_try_cmpxchg(&net->ipv6.fib6_sernum, &old, new));
Nexthop-object pcpu dsts are seeded from that generation in
ip6_rt_pcpu_alloc() and checked against it:
net/ipv6/route.c:rt6_is_valid() {
return rt6->sernum == rt_genid_ipv6(dev_net(rt6->dst.dev));
}
So each call drops and reallocates every nexthop-object pcpu dst in the
netns. ip6_dst_check() also rejects every socket-cached one, which forces
a re-lookup.
The commit message says:
Advancing the namespace generation also invalidates unrelated dsts using
nexthop objects, which are validated against that generation.
and the v3 changelog calls this harmless. Could the commit message say
that this happens once per skb? That includes bursts when the neighbor
entry for a default router fails.
For reference, rt6_insert_exception() already does the same tb6_lock plus
fib6_update_sernum() once per event. Per-event invalidation is also part
of the fix itself: coalescing would let dsts cached between two failures
survive. The later patches in the series don't change ip6_link_failure(),
and "ipv6: add ip6_dst_lookup_flow_cookie" relies on this generation
bump.
[Severity: Low]
This isn't a bug, but rt6_exception_net() is now used for a dst that is
not an exception (the !RTF_CACHE, RTF_DEFAULT branch). Here it picks the
netns whose fib6_sernum gets advanced. Its name and comment still only
describe exception accounting:
/* Exceptions are accounted to the netns their dst was allocated in.
* Unlike dev_net(dst->dev), it does not change when the device moves to
* another netns or when dst_dev_put() points the dst to blackhole_netdev.
*/
static struct net *rt6_exception_net(const struct rt6_info *rt)
The netns it returns looks correct here, and dev_net(rt->dst.dev) would
be wrong after dst_dev_put(). Other readers of the same counter, such as
rt6_is_valid() and ip6_rt_pcpu_alloc(), use dev_net(), so it isn't
obvious why this one is different.
Would it make sense to update the comment, or rename the helper, so that
it covers this use?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794906743.git.ralf%40mandelbit.com
next prev parent reply other threads:[~2026-11-19 9:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 9:21 [PATCH net-next v3 0/3] ipv6: tie the dst cookie to the lookup that returned the dst Ralf Lici
2026-11-17 9:21 ` [PATCH net-next v3 1/3] ipv6: stamp the default route node with a fresh serial on link failure Ralf Lici
2026-11-19 9:22 ` netdev-bot+sashiko [this message]
2026-11-17 9:21 ` [PATCH net-next v3 2/3] ipv6: add ip6_dst_lookup_flow_cookie Ralf Lici
2026-11-18 8:48 ` Xia Yan
2026-11-18 14:39 ` Ralf Lici
2026-11-18 15:07 ` Xia Yan
2026-11-19 9:22 ` netdev-bot+sashiko
2026-11-17 9:21 ` [PATCH net-next v3 3/3] ipv6: use lookup cookies in selected socket dst cache paths Ralf Lici
2026-11-19 9:22 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179508017302.3136.6673661223156092826@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=antonio@mandelbit.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ralf@mandelbit.com \
--cc=sd@queasysnail.net \
--cc=steffen.klassert@secunet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox