]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: hold head object state before executing ops
authorMatan Breizman <mbreizma@redhat.com>
Sun, 7 Aug 2022 11:44:09 +0000 (11:44 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Thu, 18 Aug 2022 10:59:26 +0000 (10:59 +0000)
In case that the head object will be removed, we should hold
its ObjectState before the removal.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/crimson/osd/ops_executer.cc
src/crimson/osd/ops_executer.h

index 74fffa84122f425c10a69646750255037e306ee2..6936a6994a379aa843a6bd56917d3e468b38f4fb 100644 (file)
@@ -476,7 +476,7 @@ OpsExecuter::call_errorator::future<> OpsExecuter::do_assert_ver(
 OpsExecuter::interruptible_errorated_future<OpsExecuter::osd_op_errorator>
 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<pg_log_entry_t>& 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);
index 58bdcba1419e811159df7f82f0f231906bbc2494..f187ce34507f8923de485aff2175d7071944f11f 100644 (file)
@@ -168,12 +168,12 @@ private:
   Ref<PG> 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<ExecutableMessage,
                    sizeof(ExecutableMessagePimpl<void>)> msg;
   std::optional<osd_op_params_t> osd_op_params;
   bool user_modify = false;
-  bool head_existed = false;
   ceph::os::Transaction txn;
 
   size_t num_read = 0;    ///< count read ops