Re: [1/1] libceph: use RCU to protect monmap in ceph_compare_options()
Alex Markuze <[email protected]> Tue, 7 Jul 2026 09:46:17 +0000
| Newsgroups | org.kernel.vger.ceph-devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Ren,
NACK for now. Thanks for the patch, but I have some concerns
that need a v2:
1. [major] net/ceph/mon_client.c:1032: Raw __rcu dereference in do_mon_command()
`h->fsid = monc->monmap->fsid;` is a raw dereference of the
now-`__rcu` pointer. The identical pattern in `ceph_monc_do_statfs`
was converted but this one was missed. Safe (under `monc->mutex`),
but sparse will warn and the conversion is inconsistent.
Suggested fix: Use `rcu_dereference_protected(monc->monmap,
lockdep_is_held(&monc->mutex))`, same as the other mutex-protected
sites.
2. [major] net/ceph/ceph_common.c:806: Raw __rcu dereference in wait_for_setup path
`have_monmap = client->monc.monmap && client->monc.monmap->epoch;`
— two raw accesses to the `__rcu` pointer. Under `monc->mutex`, so
safe, but sparse will flag it.
Suggested fix: Same `rcu_dereference_protected()` pattern.
3. [minor] net/ceph/mon_client.c:1175: Init-path assignment to __rcu pointer without RCU_INIT_POINTER
4. [nit] commit message: Non-standard Assisted-by trailer tag
RCU approach is correct but __rcu annotation conversion is incomplete — at least two mutex-protected sites still dereference raw, which will produce sparse warnings.
--
Alex Markuze