]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimaryLogPG: encode an empty data_bl for empty sparse reads 66912/head
authorIlya Dryomov <idryomov@gmail.com>
Tue, 13 Jan 2026 19:32:14 +0000 (20:32 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 13 Jan 2026 19:56:56 +0000 (20:56 +0100)
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 <idryomov@gmail.com>
src/osd/PrimaryLogPG.cc

index b0f12f6925c5e930e618050ec6ea8b71d23de9a3..c5cb3308262b774c65a17b748eeef190698fe1d7 100644 (file)
@@ -5991,6 +5991,8 @@ int PrimaryLogPG::do_sparse_read(OpContext *ctx, OSDOp& osd_op) {
       dout(10) << " sparse read ended up empty for " << soid << dendl;
       map<uint64_t, uint64_t> extents;
       encode(extents, osd_op.outdata);
+      bufferlist data_bl;
+      encode(data_bl, osd_op.outdata);
     }
   } else {
     // read into a buffer