]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd/osd_operation/client_request: do_process() reorder
authorMatan Breizman <mbreizma@redhat.com>
Tue, 29 Nov 2022 11:04:22 +0000 (11:04 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Sun, 21 May 2023 08:12:29 +0000 (08:12 +0000)
* Move error checking to the beginning of do_process()

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
(cherry picked from commit b1d75849312bea7b91b16336738116928c687528)

src/crimson/osd/osd_operations/client_request.cc

index 6d8bb02d21fed2e4df55dad712d8a568a86f4a4b..2cc2c59d282a0cdee0050a3a78aae01fb14007fe 100644 (file)
@@ -258,21 +258,6 @@ ClientRequest::do_process(
   instance_handle_t &ihref,
   Ref<PG>& pg, crimson::osd::ObjectContextRef obc)
 {
-  if (!pg->is_primary()) {
-    // primary can handle both normal ops and balanced reads
-    if (is_misdirected(*pg)) {
-      logger().debug("{}: dropping misdirected op", __func__);
-      return seastar::now();
-    } else if (const hobject_t& hoid = m->get_hobj();
-               !pg->get_peering_state().can_serve_replica_read(hoid)) {
-      logger().debug("{}: unstable write on replica, bouncing to primary",
-                     __func__);
-      return reply_op_error(pg, -EAGAIN);
-    } else {
-      logger().debug("{}: : serving replica read on oid {}",
-                     __func__, m->get_hobj());
-    }
-  }
   if (m->has_flag(CEPH_OSD_FLAG_PARALLELEXEC)) {
     return reply_op_error(pg, -EINVAL);
   }
@@ -304,6 +289,22 @@ ClientRequest::do_process(
     return reply_op_error(pg, -ENOENT);
   }
 
+  if (!pg->is_primary()) {
+    // primary can handle both normal ops and balanced reads
+    if (is_misdirected(*pg)) {
+      logger().trace("do_process: dropping misdirected op");
+      return seastar::now();
+    } else if (const hobject_t& hoid = m->get_hobj();
+               !pg->get_peering_state().can_serve_replica_read(hoid)) {
+      logger().debug("{}: unstable write on replica, "
+                    "bouncing to primary",
+                     __func__);
+      return reply_op_error(pg, -EAGAIN);
+    } else {
+      logger().debug("{}: serving replica read on oid {}",
+                     __func__, m->get_hobj());
+    }
+  }
   return pg->do_osd_ops(m, obc, op_info).safe_then_unpack_interruptible(
     [this, pg, &ihref](auto submitted, auto all_completed) mutable {
       return submitted.then_interruptible([this, pg, &ihref] {