Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
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] The patch says it corrects the comment in
rt6_nh_dump_exceptions() (net/ipv6/route.c), but the rewritten comment…
- [Low] The new comment on fib6_update_excp_seq() (net/ipv6/ip6_fib.c)
says "A dump notices a changed tree through the root node, so only an…
--
ipv6: tell route dumps about exception inserts with a table sequence
This adds a per-table tb6_excp_seq. rt6_insert_exception() bumps it under
tb6_lock when the exception is inserted on the root node, and
fib6_dump_table() restarts a resumed dump when either the root's
fn_sernum or tb6_excp_seq has changed. The patch also rewrites the
comment in rt6_nh_dump_exceptions() about which exception changes a
dump notices.
> diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
> index e1d49897d6ab0..4da83c22bbde8 100644
> --- a/net/ipv6/ip6_fib.c
> +++ b/net/ipv6/ip6_fib.c
> @@ -148,6 +148,25 @@ void fib6_update_sernum(struct net *net, struct fib6_info *f6i)
> WRITE_ONCE(fn->fn_sernum, fib6_new_sernum(net));
> }
>
> +/* Tell route dumps that an exception was added under @f6i. A dump notices
> + * a changed tree through the root node, so only an exception on the root
> + * needs to be visible. Use a table sequence for that, rather than a fresh
> + * fn_sernum, so that it does not depend on what else a change to fn_sernum
> + * does: fresh values can only come from the netns counter, and a made-up
> + * one could later be issued by the counter to the same node.
> + * Caller holds tb6_lock.
> + */
> +void fib6_update_excp_seq(struct fib6_info *f6i)
> +{
> + struct fib6_table *table = f6i->fib6_table;
> + struct fib6_node *fn;
> +
> + fn = rcu_dereference_protected(f6i->fib6_node,
> + lockdep_is_held(&table->tb6_lock));
> + if (fn == &table->tb6_root)
> + WRITE_ONCE(table->tb6_excp_seq, table->tb6_excp_seq + 1);
> +}
[Severity: Low]
This isn't a bug, but does this comment contradict the one this patch
adds to rt6_nh_dump_exceptions()?
This comment says only an exception on the root "needs to be visible".
The rt6_nh_dump_exceptions() comment says a change under any other node
"is not noticed: a dump suspended in the middle of that route's
exceptions can skip or repeat some of them."
tb6_excp_seq is table-wide, so fib6_dump_table() would also notice a bump
for a non-root exception. Limiting the bump to fn == &table->tb6_root
looks like a way to keep the old behaviour. It does not seem to be
enough for dump consistency.
Could the wording say this, so a later reader doesn't assume root-only
signalling is complete? The wording also looks unchanged at the end of
the series.
[ ... ]
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 5af0f26332ffa..836bd7aa05cd7 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
[ ... ]
> @@ -6125,11 +6126,15 @@ static int rt6_nh_dump_exceptions(struct fib6_nh *nh, void *arg)
> continue;
> }
>
> - /* Expiration of entries doesn't bump sernum, insertion
> - * does. Removal is triggered by insertion, so we can
> - * rely on the fact that if entries change between two
> - * partial dumps, this node is scanned again completely,
> - * see rt6_insert_exception() and fib6_dump_table().
> + /* Expiration of entries doesn't bump anything. An
> + * insertion on the root node changes the root's
> + * fn_sernum or tb6_excp_seq, and removal is triggered
> + * by insertion, so if entries of the root change
> + * between two partial dumps, the table is scanned
> + * again, see rt6_insert_exception() and
> + * fib6_dump_table(). A change under any other node is
> + * not noticed: a dump suspended in the middle of that
> + * route's exceptions can skip or repeat some of them.
> *
> * Count expired entries we go through as handled
> * entries that we'll skip next time, in case of partial
[Severity: Medium]
The commit message says this corrects the comment. Is the part saying
"removal is triggered by insertion" still accurate?
Only two rt6_remove_exception() calls run under rt6_insert_exception().
One is the eviction in rt6_exception_remove_oldest(), the other replaces
a matching entry. rt6_insert_exception() is also the only caller of
fib6_update_excp_seq().
The other removals change neither the root's fn_sernum nor
tb6_excp_seq:
fib6_nh_remove_exception(), reached via rt6_remove_exception_rt() on
RTM_DELROUTE of a cached route, on negative advice and on link failure
fib6_nh_exceptions_clean_tohost()
fib6_nh_flush_exceptions()
rt6_age_examine_exception(), called from GC
net/ipv6/route.c:rt6_age_examine_exception() {
...
if (time_after_eq(now, READ_ONCE(rt->dst.lastuse) +
gc_args->timeout)) {
pr_debug("aging clone %p\n", rt);
rt6_remove_exception(bucket, rt6_ex);
return;
}
} else if (time_after(jiffies, READ_ONCE(rt->dst.expires))) {
pr_debug("purging expired route %p\n", rt);
rt6_remove_exception(bucket, rt6_ex);
return;
}
...
}
GC removes more than expired entries. It also removes aged
non-RTF_EXPIRES clones and gateway exceptions whose gateway is not a
router.
Say a dump is suspended part-way through the root route's exceptions
with skip_in_node = k. One of the entries already sent is then removed
by one of these paths. On resume, fib6_dump_table() sees the same values:
if (cb->args[5] != sernum || w->excp_seq != excp_seq) {
So there is no restart, and rt6_nh_dump_exceptions() applies the stale
skip count to the shorter chain:
if (w->skip) {
w->skip--;
continue;
}
Wouldn't that drop a valid exception that was never sent, without
setting NLM_F_DUMP_INTR?
The skipping itself is older than this patch. The rewritten comment,
though, repeats the inaccurate premise.
The comment is also inaccurate for insertions. With nexthop objects, an
exception can be inserted through a non-root route that shares the
nexthop's fib6_nh. That changes the root route's dumped exceptions, and
neither fn_sernum nor tb6_excp_seq is bumped.
This comment also appears unchanged at the end of the series.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40kernel.org