From: Xuehan Xu Date: Wed, 11 Feb 2026 06:50:27 +0000 (+0800) Subject: crimson/os/seastore: correct the exception condition when merging X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1efef08a2cd6ddb7befb5676b438791fbe704cdd;p=ceph.git crimson/os/seastore: correct the exception condition when merging rewritten fixed kv nodes Fixes: https://tracker.ceph.com/issues/74798 Signed-off-by: Xuehan Xu --- diff --git a/src/crimson/os/seastore/btree/fixed_kv_node.h b/src/crimson/os/seastore/btree/fixed_kv_node.h index fdd67e49656..5ad9b60f2c0 100644 --- a/src/crimson/os/seastore/btree/fixed_kv_node.h +++ b/src/crimson/os/seastore/btree/fixed_kv_node.h @@ -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; } diff --git a/src/crimson/os/seastore/lba/lba_btree_node.h b/src/crimson/os/seastore/lba/lba_btree_node.h index 7944b8f6cec..b6831f6a210 100644 --- a/src/crimson/os/seastore/lba/lba_btree_node.h +++ b/src/crimson/os/seastore/lba/lba_btree_node.h @@ -295,19 +295,26 @@ struct LBALeafNode auto &pending_version = static_cast(*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 ©_dest : copy_dests.dests_by_key) { auto &pending_version = static_cast(*copy_dest); - ceph_assert(pending_version.is_pending()); + assert(pending_version.is_pending()); } #endif this->merge_content_to(t, copy_dests.dests_by_key); diff --git a/src/crimson/os/seastore/linked_tree_node.h b/src/crimson/os/seastore/linked_tree_node.h index ec5dd810275..a3164fd0369 100644 --- a/src/crimson/os/seastore/linked_tree_node.h +++ b/src/crimson/os/seastore/linked_tree_node.h @@ -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 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(); }