From 7b8766c86cfbf700beda8cef29764a4eb84db9d3 Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Tue, 29 Nov 2022 11:04:22 +0000 Subject: [PATCH] crimson/osd/osd_operation/client_request: do_process() reorder * Move error checking to the beginning of do_process() Signed-off-by: Matan Breizman (cherry picked from commit b1d75849312bea7b91b16336738116928c687528) --- .../osd/osd_operations/client_request.cc | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index 6d8bb02d21f..2cc2c59d282 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -258,21 +258,6 @@ ClientRequest::do_process( instance_handle_t &ihref, Ref& 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] { -- 2.39.5