From 2dc0f00a9202335cf44bd83c7a704c422b8f4383 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Tue, 13 Jan 2026 20:32:14 +0100 Subject: [PATCH] osd/PrimaryLogPG: encode an empty data_bl for empty sparse reads Commit 0cf383da0741 ("ReplicatedPG: clamp SPARSE_READ to object size for ec pool") didn't handle the case of a sparse read that ends up being empty correctly: the OSD encodes only an empty extent map whereas clients (both userspace and kernel) also expect to see an empty data buffer. IOW the reply contains one 32-bit zero instead of the expected two. Fixes: https://tracker.ceph.com/issues/74394 Signed-off-by: Ilya Dryomov (cherry picked from commit c694c35bbfce6e3033b34fe6994b40b00fad11d9) --- src/osd/PrimaryLogPG.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 2b17903c8711..4ae18ecc6578 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -5902,6 +5902,8 @@ int PrimaryLogPG::do_sparse_read(OpContext *ctx, OSDOp& osd_op) { dout(10) << " sparse read ended up empty for " << soid << dendl; map extents; encode(extents, osd_op.outdata); + bufferlist data_bl; + encode(data_bl, osd_op.outdata); } } else { // read into a buffer -- 2.47.3