[PATCH v2 0/4] libceph: support pg_upmap_primary (the read balancer)

From: Xiubo Li via B4 Relay

Date: Thu Dec 03 2026 - 08:25:05 EST


Since reef, the mgr read balancer ("ceph balancer mode read" or
"upmap-read") and "ceph osd pg-upmap-primary" choose the primary of
each PG explicitly, so that reads, which normally go to the primary,
are spread evenly over the OSDs.

Kernel clients cannot take part today. libceph does not decode
pg_upmap_primary and does not advertise SERVER_REEF, the feature the
monitors require from every client once the OSDMap holds such an
entry. So "ceph osd set-require-min-compat-client reef" is refused
while kernel clients are connected, and a kernel client can neither
mount CephFS nor map an rbd image on a cluster that already uses the
read balancer:

libceph: RADOS feature set mismatch: server's required > my supported 0x2f018fb87aa4aafe, missing 0x80000000
libceph: mon0 (2)127.0.0.1:17300 missing required protocol features

Patches 1 and 2 fix two older libceph problems that a changing primary
makes easier to hit. Patch 1 resends a balanced or localized read on
any new interval, as the replica drops it otherwise, also when only
the up set changes. Patch 2 asks for a full map when an incremental
fails to apply half way, instead of routing requests with the half
updated map. Patch 3 decodes the mappings from full and incremental
maps and applies them the way OSDMap::_apply_upmap() does. Patch 4
advertises SERVER_REEF, which towards clients only selects the OSDMap
encodings that carry pg_upmap_primary.

Tested with the series applied to a 7.2-based tree, built as the
libceph, ceph and rbd modules, against a 3-OSD tentacle cluster:
CephFS mounts and rbd maps work with the read balancer on, the
kernel's pg_upmap_primary entries follow the cluster through full and
incremental maps, and all I/O of a PG goes to the chosen primary.
Without entries, krbd fio and an IO500 run show no difference from the
unpatched modules. The read balancer numbers are in patch 4.

---
Changes in v2:
- New patch 1: resend replica reads on a new interval, also when the
acting set does not change (Alex).
- New patch 2: get a full osdmap after failing to apply an
incremental, instead of keeping a partially applied map (Alex).
- Patches 3 and 4 are v1 patches 1 and 2; patch 3 only tab-aligns a
comment in osdmap.h.
- Link to v1: https://patch.msgid.link/20261130-b4-libceph-upmap-primary-v1-0-247b0a3d2e13@xxxxxxxxx

---
Xiubo Li (4):
libceph: resend replica reads on a new interval
libceph: get a full osdmap after failing to apply an incremental
libceph: decode and apply pg_upmap_primary mappings
libceph: advertise SERVER_REEF

include/linux/ceph/ceph_features.h | 4 +-
include/linux/ceph/osd_client.h | 1 +
include/linux/ceph/osdmap.h | 4 ++
net/ceph/debugfs.c | 12 ++++-
net/ceph/osd_client.c | 71 +++++++++++++++++++++------
net/ceph/osdmap.c | 99 +++++++++++++++++++++++++++++++++++++-
6 files changed, 173 insertions(+), 18 deletions(-)
---
base-commit: 3f90412e989cb381d4bf96260468f5c7b2d08655
change-id: 20261130-b4-libceph-upmap-primary-9fc9dbab8652

Best regards,
--
Xiubo Li <xiubo.li@xxxxxxxxx>