Skip to content

Commit 7756048

Browse files
committed
crimson/.../fixed_kv_node: don't call copy_out if delta_buffer is empty
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 <[email protected]>
1 parent 7b5fe62 commit 7756048

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/crimson/os/seastore/btree/fixed_kv_node.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,11 @@ struct FixedKVInternalNode
440440
}
441441

442442
ceph::bufferlist get_delta() {
443-
ceph::buffer::ptr bptr(delta_buffer.get_bytes());
443+
auto buffer_len = delta_buffer.get_bytes();
444+
if (buffer_len == 0) {
445+
return ceph::bufferlist();
446+
}
447+
ceph::buffer::ptr bptr(buffer_len);
444448
delta_buffer.copy_out(bptr.c_str(), bptr.length());
445449
ceph::bufferlist bl;
446450
bl.push_back(bptr);

0 commit comments

Comments
 (0)