]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/osd_operations/client_request: cleanup, drop CommonClientRequest::recover...
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 22 Apr 2024 06:31:18 +0000 (14:31 +0800)
committerMatan Breizman <mbreizma@redhat.com>
Thu, 13 Jun 2024 12:18:56 +0000 (15:18 +0300)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
(cherry picked from commit 5c1595d8441b61bd9d0ea4eb72c6079b395b0d1c)

src/crimson/osd/osd_operations/client_request.cc
src/crimson/osd/osd_operations/client_request_common.cc
src/crimson/osd/osd_operations/client_request_common.h

index 0d79c4f132c26272ed78d34971a3cd92d214c365..8f31284dab4b60b469fbf7bc394f93c894040db6 100644 (file)
@@ -260,8 +260,43 @@ ClientRequest::process_op(
   co_await ihref.enter_stage<interruptor>(
     client_pp(*pg).recover_missing, *this
   );
-  co_await recover_missings(pg, m->get_hobj(),
-                            snaps_need_to_recover(), m->get_reqid());
+  if (!pg->is_primary()) {
+    DEBUGDPP(
+      "Skipping recover_missings on non primary pg for soid {}",
+      *pg, m->get_hobj());
+  } else {
+    co_await do_recover_missing(pg, m->get_hobj().get_head(), m->get_reqid());
+    std::set<snapid_t> snaps = snaps_need_to_recover();
+    if (!snaps.empty()) {
+      auto with_obc = pg->obc_loader.with_obc<RWState::RWREAD>(
+        m->get_hobj().get_head(),
+        [&snaps, pg, this](auto head, auto) {
+        return InterruptibleOperation::interruptor::do_for_each(
+          snaps,
+          [head, pg, this](auto &snap)
+          -> InterruptibleOperation::template interruptible_future<> {
+          auto coid = head->obs.oi.soid;
+          coid.snap = snap;
+          auto oid = resolve_oid(head->get_head_ss(), coid);
+          /* Rollback targets may legitimately not exist if, for instance,
+           * the object is an rbd block which happened to be sparse and
+           * therefore non-existent at the time of the specified snapshot.
+           * In such a case, rollback will simply delete the object.  Here,
+           * we skip the oid as there is no corresponding clone to recover.
+           * See https://tracker.ceph.com/issues/63821 */
+          if (oid) {
+            return do_recover_missing(pg, *oid, m->get_reqid());
+          } else {
+            return seastar::now();
+          }
+        });
+      }).handle_error_interruptible(
+        crimson::ct_error::assert_all("unexpected error")
+      );
+      // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98401
+      co_await std::move(with_obc);
+    }
+  }
 
   DEBUGDPP("{}.{}: checking already_complete",
           *pg, *this, this_instance_id);
index 657bdf7bd60bbf4bc7fc3fdc15130e091568dbe4..547b9f2db2f44a0062f5693e90af29e9e4016237 100644 (file)
@@ -11,61 +11,8 @@ namespace {
   }
 }
 
-SET_SUBSYS(osd);
-
 namespace crimson::osd {
 
-InterruptibleOperation::template interruptible_future<>
-CommonClientRequest::recover_missings(
-  Ref<PG> pg,
-  const hobject_t& soid,
-  std::set<snapid_t> &&snaps,
-  const osd_reqid_t& reqid)
-{
-  LOG_PREFIX(CommonClientRequest::recover_missings);
-  if (!pg->is_primary()) {
-    DEBUGDPP(
-      "Skipping recover_missings on non primary pg for soid {}", *pg, soid);
-    return seastar::now();
-  }
-  return do_recover_missing(
-    pg, soid.get_head(), reqid
-  ).then_interruptible([snaps=std::move(snaps), pg, soid, reqid]() mutable {
-    if (snaps.empty()) {
-      return InterruptibleOperation::interruptor::now();
-    }
-    return seastar::do_with(
-      std::move(snaps),
-      [pg, soid, reqid](auto& snaps) {
-      return pg->obc_loader.with_obc<RWState::RWREAD>(
-        soid.get_head(),
-        [&snaps, pg, soid, reqid](auto head, auto) {
-        return InterruptibleOperation::interruptor::do_for_each(
-          snaps,
-          [pg, soid, head, reqid](auto &snap)
-          -> InterruptibleOperation::template interruptible_future<> {
-          auto coid = head->obs.oi.soid;
-          coid.snap = snap;
-          auto oid = resolve_oid(head->get_head_ss(), coid);
-          /* Rollback targets may legitimately not exist if, for instance,
-           * the object is an rbd block which happened to be sparse and
-           * therefore non-existent at the time of the specified snapshot.
-           * In such a case, rollback will simply delete the object.  Here,
-           * we skip the oid as there is no corresponding clone to recover.
-           * See https://tracker.ceph.com/issues/63821 */
-          if (oid) {
-            return do_recover_missing(pg, *oid, reqid);
-          } else {
-            return seastar::now();
-          }
-        });
-      }).handle_error_interruptible(
-        crimson::ct_error::assert_all("unexpected error")
-      );
-    });
-  });
-}
-
 typename InterruptibleOperation::template interruptible_future<>
 CommonClientRequest::do_recover_missing(
   Ref<PG> pg,
index 906ce53b50a95d16a9db568d75d25015ce5c06cc..85f118d64c16fd527e7f59eddcaba7523dd6ef5b 100644 (file)
@@ -11,13 +11,6 @@ namespace crimson::osd {
 
 struct CommonClientRequest {
 
-  static InterruptibleOperation::template interruptible_future<>
-  recover_missings(
-    Ref<PG> pg,
-    const hobject_t& soid,
-    std::set<snapid_t> &&snaps,
-    const osd_reqid_t& reqid);
-
   static InterruptibleOperation::template interruptible_future<>
   do_recover_missing(
     Ref<PG> pg,