]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/.../fixed_kv_node: don't call copy_out if delta_buffer is empty 65017/head
authorSamuel Just <sjust@redhat.com>
Wed, 13 Aug 2025 16:54:35 +0000 (09:54 -0700)
committerSamuel Just <sjust@redhat.com>
Tue, 19 Aug 2025 20:01:48 +0000 (20:01 +0000)
Cache::mark_transaction_conflicted calls get_delta(), which in turn
calls FixedKVNodeLayout::copy_out for lba nodes. If the mutation_pending
extent happens not to have any deltas, it'll fail in memcpy in
FixedKVNodeLayout::copy_out.

I think this is valid because a transaction may become conflicted
between when duplicate_for_write is called and when the actual mutation
is performed on the extent.

Fixes: https://tracker.ceph.com/issues/72579
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/btree/fixed_kv_node.h

index 23d3b38f84becf947cb70009b0c1bd4d54d7ac1a..f27c042bdf0af47740a626d302876423c1960d06 100644 (file)
@@ -440,7 +440,11 @@ struct FixedKVInternalNode
   }
 
   ceph::bufferlist get_delta() {
-    ceph::buffer::ptr bptr(delta_buffer.get_bytes());
+    auto buffer_len = delta_buffer.get_bytes();
+    if (buffer_len == 0) {
+      return ceph::bufferlist();
+    }
+    ceph::buffer::ptr bptr(buffer_len);
     delta_buffer.copy_out(bptr.c_str(), bptr.length());
     ceph::bufferlist bl;
     bl.push_back(bptr);