On 11/27/26 4:03 AM, Ralf Lici wrote:
> On Wed, 25 Nov 2026 18:33:32 -0700, David Ahern <dsah…@kernel.org> wrote:
>> @@ -1476,7 +1483,11 @@ static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res) >> >> pcpu_rt = this_cpu_read(*res->nh->rt6i_pcpu); >> >> - if (pcpu_rt && READ_ONCE(pcpu_rt->sernum) && !rt6_is_valid(pcpu_rt)) { >> + /* A dst stamped with an older genid stays stale for everyone still >> + * holding it, as in IPv4. Never re-stamp it; drop it and build a >> + * new one. >> + */ >> + if (pcpu_rt && !rt6_is_valid(pcpu_rt)) { >> struct rt6_info *prev, **p;
> > This now evicts the pcpu dst of every route after any generation change, > and the eviction still drops the slot's reference right away > (rt6_uncached_list_add and dst_release from 02/13). A reader that took > the dst from the slot without a reference can then see it freed, when > the only other reference is the child reference of an xfrm bundle: > > 1. Bundle X, whose child is the pcpu dst P of CPU0, drops its last > reference, and dst_release queues dst_destroy_rcu. > 2. After that grace period has started, a lookup with > RT6_LOOKUP_F_DST_NOREF on CPU0 gets P from the slot inside its RCU > section, and is preempted (PREEMPT_RCU) before dst_hold_safe. > 3. A lookup on CPU0 after a generation change evicts P and drops the > slot's reference, so X's child reference is the last one. > 4. X's grace period ends without waiting for the first lookup, and > dst_destroy(X) frees P with dst_release_immediate. > > Mainline only evicts nexthop-object dsts this way, and > fib6_nh_release_dsts has the same pattern, as Sashiko pointed out on my
I do not recall that being intentional. If anything we want consistency across built-in nexthops and separate nexthop objects.