]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/cache: validate extents that skip complete_commit()
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 13 Jun 2025 08:56:42 +0000 (16:56 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Tue, 17 Jun 2025 04:46:42 +0000 (12:46 +0800)
Also reset pending_for_transaction if EXIST_CLEAN.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cache.cc

index 8d7d52f14dbfdeb73c2dfa29a92e69a94abad92b..d6c8c4995946a4714903aea8554f35dba19689f0 100644 (file)
@@ -1312,7 +1312,7 @@ record_t Cache::prepare_record(
       // the existing extents should be added into Cache
       // during complete_commit to sync with gc transaction.
       commit_replace_extent(t, i, i->prior_instance);
-    } // Note, else, add_extent() below
+    } // Note, else(is_exist_mutation_pending), add_extent() atomically
     // Note, i->state become DIRTY in complete_commit()
 
     assert(i->get_version() > 0);
@@ -1530,12 +1530,15 @@ record_t Cache::prepare_record(
     }
     assert(i->state == CachedExtent::extent_state_t::DIRTY);
     assert(i->version > 0);
+    assert(i->pending_for_transaction == TRANS_ID_NULL);
+    assert(!i->prior_instance);
     remove_from_dirty(i, &trans_src);
     // set the version to zero because the extent state is now clean
     // in order to handle this transparently
     i->version = 0;
     i->dirty_from = JOURNAL_SEQ_MIN;
-    // no set_io_wait()
+    // no set_io_wait(), skip complete_commit()
+    assert(!i->is_pending_io());
     i->state = CachedExtent::extent_state_t::CLEAN;
     assert(i->is_logical());
     i->clear_modified_region();
@@ -1557,7 +1560,11 @@ record_t Cache::prepare_record(
     }
 
     if (i->is_exist_clean()) {
-      // no set_io_wait()
+      assert(i->version == 0);
+      assert(!i->prior_instance);
+      // no set_io_wait(), skip complete_commit()
+      assert(!i->is_pending_io());
+      i->pending_for_transaction = TRANS_ID_NULL;
       i->state = CachedExtent::extent_state_t::CLEAN;
     } else {
       assert(i->is_exist_mutation_pending());