From 7171ca64c3baf031508ada6098494a9060614240 Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Sun, 7 Aug 2022 11:44:09 +0000 Subject: [PATCH] crimson/osd: hold head object state before executing ops In case that the head object will be removed, we should hold its ObjectState before the removal. Signed-off-by: Matan Breizman --- src/crimson/osd/ops_executer.cc | 8 ++++---- src/crimson/osd/ops_executer.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/crimson/osd/ops_executer.cc b/src/crimson/osd/ops_executer.cc index 74fffa84122f4..6936a6994a379 100644 --- a/src/crimson/osd/ops_executer.cc +++ b/src/crimson/osd/ops_executer.cc @@ -476,7 +476,7 @@ OpsExecuter::call_errorator::future<> OpsExecuter::do_assert_ver( OpsExecuter::interruptible_errorated_future OpsExecuter::execute_op(OSDOp& osd_op) { - head_existed = obc->obs.exists; + head_os = obc->obs; return do_execute_op(osd_op).handle_error_interruptible( osd_op_errorator::all_same_way([&osd_op](auto e, auto&& e_raw) -> OpsExecuter::osd_op_errorator::future<> { @@ -748,7 +748,7 @@ void OpsExecuter::make_writeable(std::vector& log_entries) obc->ssc->snapset, snapc); // clone? - if (head_existed && // old obs.exists + if (head_os.exists && // old obs.exists snapc.snaps.size() && // there are snaps snapc.snaps[0] > obc->ssc->snapset.seq) { // existing obj is old @@ -823,8 +823,8 @@ const object_info_t OpsExecuter::prepare_clone( { object_info_t static_snap_oi(coid); static_snap_oi.version = osd_op_params->at_version; - static_snap_oi.prior_version = obc->obs.oi.version; - static_snap_oi.copy_user_bits(obc->obs.oi); + static_snap_oi.prior_version = head_os.oi.version; + static_snap_oi.copy_user_bits(head_os.oi); if (static_snap_oi.is_whiteout()) { // clone shouldn't be marked as whiteout static_snap_oi.clear_flag(object_info_t::FLAG_WHITEOUT); diff --git a/src/crimson/osd/ops_executer.h b/src/crimson/osd/ops_executer.h index 58bdcba1419e8..f187ce34507f8 100644 --- a/src/crimson/osd/ops_executer.h +++ b/src/crimson/osd/ops_executer.h @@ -168,12 +168,12 @@ private: Ref pg; // for the sake of object class ObjectContextRef obc; ObjectContextRef clone_obc; // if we create a clone + ObjectState head_os; const OpInfo& op_info; ceph::static_ptr)> msg; std::optional osd_op_params; bool user_modify = false; - bool head_existed = false; ceph::os::Transaction txn; size_t num_read = 0; ///< count read ops -- 2.39.5