]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: correct the exception condition when merging
authorXuehan Xu <xuxuehan@qianxin.com>
Wed, 11 Feb 2026 06:50:27 +0000 (14:50 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Mon, 9 Mar 2026 09:56:41 +0000 (17:56 +0800)
rewritten fixed kv nodes

Fixes: https://tracker.ceph.com/issues/74798
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/crimson/os/seastore/btree/fixed_kv_node.h
src/crimson/os/seastore/lba/lba_btree_node.h
src/crimson/os/seastore/linked_tree_node.h

index fdd67e496561343faf8b93b6a263ebc6f0159273..5ad9b60f2c0bc2d2e347d051625db3d6222230fd 100644 (file)
@@ -526,8 +526,9 @@ struct FixedKVInternalNode
       auto it = pending_version.begin();
       while (it != pending_version.end() && iter != this->end()) {
         if (auto child = pending_version.children[it->get_offset()];
-            (is_valid_child_ptr(child) &&
-             (pending_version.is_pending() || child->_is_pending_io()))) {
+            is_valid_child_ptr(child) &&
+            (child->_is_mutable() || child->_is_pending_io())) {
+          // skip the ones that the pending version is also modifying
           it++;
           continue;
         }
index 7944b8f6cec66ebee91c9db2b16effa38b48b6f6..b6831f6a210f1f6d5fcbc09d7ca7eab1000292d2 100644 (file)
@@ -295,19 +295,26 @@ struct LBALeafNode
       auto &pending_version = static_cast<LBALeafNode&>(*copy_dest);
       auto it = pending_version.begin();
       while (it != pending_version.end() && iter != this->end()) {
-        if (iter->get_val().pladdr.is_laddr() ||
-            iter->get_val().pladdr.get_paddr().is_zero()) {
+        const auto &v1 = iter->get_val();
+        if (v1.pladdr.is_laddr() ||
+            v1.pladdr.get_paddr().is_zero()) {
           iter++;
           continue;
         }
+        if (const auto &v2 = it->get_val();
+            v2.pladdr.is_laddr() || v2.pladdr.get_paddr().is_zero()) {
+          it++;
+          continue;
+        }
         if (auto child = pending_version.children[it->get_offset()];
             is_valid_child_ptr(child) &&
-            (pending_version.is_pending() || child->_is_pending_io())) {
+            (child->_is_mutable() || child->_is_pending_io())) {
+          // skip the ones that the pending version is also modifying
           it++;
           continue;
         }
         if (it->get_key() == iter->get_key()) {
-          it->set_val(iter->get_val());
+          it->set_val(v1);
           it++;
           iter++;
         } else if (it->get_key() > iter->get_key()) {
@@ -330,7 +337,7 @@ struct LBALeafNode
 #ifndef NDEBUG
       for (auto &copy_dest : copy_dests.dests_by_key) {
         auto &pending_version = static_cast<LBALeafNode&>(*copy_dest);
-        ceph_assert(pending_version.is_pending());
+        assert(pending_version.is_pending());
       }
 #endif
       this->merge_content_to(t, copy_dests.dests_by_key);
index ec5dd810275d46cf1ec6520776ebf22f0af681d6..a3164fd0369e9404a61b925b068ad7bca3b2fcee 100644 (file)
@@ -231,6 +231,9 @@ public:
   virtual key_t node_begin() const = 0;
   virtual bool is_retired_placeholder() const = 0;
   virtual bool _is_pending_io() const = 0;
+  virtual bool _is_mutable() const = 0;
+  virtual bool _is_exist_clean() const = 0;
+  virtual bool _is_exist_mutation_pending() const = 0;
 protected:
   parent_tracker_ref<ParentT> parent_tracker;
   virtual bool _is_valid() const = 0;
@@ -1176,6 +1179,15 @@ private:
   bool _is_stable() const final {
     return down_cast().is_stable();
   }
+  bool _is_mutable() const final {
+    return down_cast().is_mutable();
+  }
+  bool _is_exist_clean() const final {
+    return down_cast().is_exist_clean();
+  }
+  bool _is_exist_mutation_pending() const final {
+    return down_cast().is_exist_mutation_pending();
+  }
   bool _is_pending_io() const final {
     return down_cast().is_pending_io();
   }