Re: fs/ceph/caps: skip __touch_cap() most of the time

Alex Markuze <[email protected]> Mon, 6 Jul 2026 14:38:45 +0000
Newsgroups org.kernel.vger.ceph-devel
Message-ID <[email protected]>
Hi Max,

NACK for now. Thanks for the patch, but I have some concerns
that need a v2:

  1. fs/ceph/caps.c:876: Unannotated data race on skip_counter
     `skip_counter` is a function-static variable updated by all
     `__touch_cap()` callers concurrently (only per-inode locks are
     held, not a shared lock). The bare `++skip_counter` is an
     unannotated data race that will fire KCSAN warnings. The commit
     message acknowledges the race but doesn't use the kernel's
     convention to mark it.
     Suggested fix: Wrap the access: `if (data_race(++skip_counter))` —
     documents intent and silences KCSAN. Alternatively,
     `DEFINE_PER_CPU(u8, skip_counter)` eliminates the race entirely at
     negligible cost.
  2. fs/ceph/caps.c:874: Use u8 instead of uint8_t
     Kernel convention (and the rest of `fs/ceph/`) uses `u8`, not
     `uint8_t`.
     Suggested fix: `static u8 skip_counter;`

Good perf win but needs data_race() annotation on skip_counter and u8 kernel type convention.


-- 
Alex Markuze