Hi Mikulas,
Sorry for the very late reply.
Thank you for the pointer to c2e894eac398. I checked the latest tree
(7.4-rc1), and the bug is already gone there. In kset_replay() the
generation check now reads
if (key->seg_gen < key->cache_pos.cache_seg->gen) {
cache_key_put(key);
continue;
}
so the stale key is dropped and never touched again, and __set_bit() and
cache_seg_get() only run for valid keys. The fix has been there since
v7.3-rc1, so no current tree is affected. I also see that the commit
already carries a Cc: stable tag, so nothing is missing there either.
There is nothing left to fix, so please disregard my patch and feel free
to mark the patchwork entry as superseded. I should add that the approach
in it was wrong as well: pinning the segment before the generation check
takes a reference on the segment of a stale key, and since that key is
freed and never inserted into the tree, the reference would never be
dropped.
The patch was generated against an older tree and I did not recheck the
current one before sending it, which is what I got wrong here. For
transparency about how it was produced: the candidate came from our
static analysis tooling, and DeepSeek and GPT-6.1 Sol were used to audit
it and help write the change. I reviewed it and I am responsible for it.
I am going through the rest of the outstanding feedback by hand and
answering it one thread at a time.
Thanks,
Wentao