]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/cache: reset version to 1 if inplace write occurs before in prepa...
authorMyoungwon Oh <myoungwon.oh@samsung.com>
Tue, 12 Dec 2023 09:55:47 +0000 (18:55 +0900)
committerMyoungwon Oh <myoungwon.oh@samsung.com>
Fri, 5 Jan 2024 06:43:55 +0000 (15:43 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/os/seastore/cache.cc

index 8645a3071062f66ef899ea747a8627522cb902f7..fe42efa74ad70ec4af7fb6c8b05cc04a070535e0 100644 (file)
@@ -1096,6 +1096,20 @@ record_t Cache::prepare_record(
     if (!i->is_exist_mutation_pending()) {
       DEBUGT("commit replace extent ... -- {}, prior={}",
             t, *i, *i->prior_instance);
+      // If inplace rewrite occurs during mutation, prev->version will
+      // be zero. Although this results in the version mismatch here, we can
+      // correct this by changing version to 1. This is because the inplace rewrite
+      // does not introduce any actual modification that could negatively
+      // impact system reliability
+      if (i->prior_instance->version == 0 && i->version > 1) {
+       assert(can_inplace_rewrite(i->get_type()));
+       assert(can_inplace_rewrite(i->prior_instance->get_type()));
+       assert(i->prior_instance->dirty_from_or_retired_at == JOURNAL_SEQ_MIN);
+       assert(i->prior_instance->state == CachedExtent::extent_state_t::CLEAN);
+       assert(i->prior_instance->get_paddr().get_addr_type() ==
+         paddr_types_t::RANDOM_BLOCK);
+       i->version = 1;
+      }
       // extent with EXIST_MUTATION_PENDING doesn't have
       // prior_instance field so skip these extents.
       // the existing extents should be added into Cache