From: Samuel Just Date: Wed, 14 Sep 2022 23:32:42 +0000 (-0700) Subject: crimson/.../node.cc: fix Node initialization argument passing X-Git-Tag: v18.0.0~32^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=420ff0b4754b773e99aa42d240ebf9126294213b;p=ceph-ci.git crimson/.../node.cc: fix Node initialization argument passing Argument evaluation order is unspecified, clang seems to be choosing to execute the std::unique_ptr move constructor before the call to get(), causing the first argument to be passed as null. https://tracker.ceph.com/issues/57530 Signed-off-by: Samuel Just --- diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc index 6a8f82feafd..5e44f471fd1 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc @@ -736,8 +736,9 @@ eagain_ifuture> Node::load( ceph_abort("fatal error"); } auto impl = LeafNodeImpl::load(extent, *field_type); + auto *derived_ptr = impl.get(); return eagain_iertr::make_ready_future>( - new LeafNode(impl.get(), std::move(impl))); + new LeafNode(derived_ptr, std::move(impl))); } else if (node_type == node_type_t::INTERNAL) { if (extent->get_length() != c.vb.get_internal_node_size()) { ERRORT("load addr={:x}, is_level_tail={} error, " @@ -746,8 +747,9 @@ eagain_ifuture> Node::load( ceph_abort("fatal error"); } auto impl = InternalNodeImpl::load(extent, *field_type); + auto *derived_ptr = impl.get(); return eagain_iertr::make_ready_future>( - new InternalNode(impl.get(), std::move(impl))); + new InternalNode(derived_ptr, std::move(impl))); } else { ceph_abort("impossible path"); } @@ -1762,8 +1764,9 @@ eagain_ifuture InternalNode::allocate( { return InternalNodeImpl::allocate(c, hint, field_type, is_level_tail, level ).si_then([](auto&& fresh_impl) { + auto *derived_ptr = fresh_impl.impl.get(); auto node = Ref(new InternalNode( - fresh_impl.impl.get(), std::move(fresh_impl.impl))); + derived_ptr, std::move(fresh_impl.impl))); return fresh_node_t{node, fresh_impl.mut}; }); } @@ -2262,8 +2265,9 @@ eagain_ifuture LeafNode::allocate( { return LeafNodeImpl::allocate(c, hint, field_type, is_level_tail ).si_then([](auto&& fresh_impl) { + auto *derived_ptr = fresh_impl.impl.get(); auto node = Ref(new LeafNode( - fresh_impl.impl.get(), std::move(fresh_impl.impl))); + derived_ptr, std::move(fresh_impl.impl))); return fresh_node_t{node, fresh_impl.mut}; }); }