]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore: deepcopy the buffer of exist clean extent when duplicate_for_write
authorXinyu Huang <xinyu.huang@intel.com>
Wed, 19 Apr 2023 01:46:31 +0000 (01:46 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 11 Oct 2023 11:40:57 +0000 (11:40 +0000)
Beacuse exist clean extent shares buffer with original clean extent.

Signed-off-by: Xinyu Huang <xinyu.huang@intel.com>
(cherry picked from commit 026066a7e5c4cc1bc04ed91003c553146a0b60ef)

src/crimson/os/seastore/cache.cc

index 255f0c26237e22266ac14b594d03c438f3836f78..91f7794f750808a7dfc5f3c6ba31df7038bb6030 100644 (file)
@@ -1012,6 +1012,12 @@ CachedExtentRef Cache::duplicate_for_write(
     i->version++;
     i->state = CachedExtent::extent_state_t::EXIST_MUTATION_PENDING;
     i->last_committed_crc = i->get_crc32c();
+    // deepcopy the buffer of exist clean extent beacuse it shares
+    // buffer with original clean extent.
+    auto bp = i->get_bptr();
+    auto nbp = ceph::bufferptr(bp.c_str(), bp.length());
+    i->set_bptr(std::move(nbp));
+
     t.add_mutated_extent(i);
     DEBUGT("duplicate existing extent {}", t, *i);
     return i;