From 21e31280cfd1fe2e110b82b7c8a5e4dfde729bd9 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Tue, 23 Mar 2021 20:45:17 +0000 Subject: [PATCH] crimson/osd: PG::repair_object() doesn't depend on MOSDOp anymore. Before this commit the method was depending on `MOSDOp::get_min_epoch()` to start an `UrgentRecovery`. However, it seems `PG::get_osdmap_epoch()` would be sufficient here as the very early stages of the processing in `ClientRequest` ensure the PG fits the `get_min_epoch()` requirement. In the classical OSD the counterpart code looks like below: ``` int PrimaryLogPG::rep_repair_primary_object(const hobject_t& soid, OpContext *ctx) { // ... queue_peering_event( PGPeeringEventRef( std::make_shared( get_osdmap_epoch(), get_osdmap_epoch(), PeeringState::DoRecovery()))); return -EAGAIN; } ``` In addition to the dependency minimalisation, the commits reformats the code around `PG::repair_object()` to fit our guidelines. Signed-off-by: Radoslaw Zarzynski --- src/crimson/osd/pg.cc | 12 +++++------- src/crimson/osd/pg.h | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 99d704bf207a..d7c4f87a659f 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -683,7 +683,6 @@ PG::interruptible_future> PG::handle_failed_op( } PG::interruptible_future<> PG::repair_object( - Ref m, const hobject_t& oid, eversion_t& v) { @@ -693,8 +692,8 @@ PG::interruptible_future<> PG::repair_object( // Add object to PG's missing set if it isn't there already assert(!get_local_missing().is_missing(oid)); peering_state.force_object_missing(pg_whoami, oid, v); - auto [op, fut] = get_shard_services().start_operation( - oid, v, this, get_shard_services(), m->get_min_epoch()); + auto [op, fut] = get_shard_services().start_operation( + oid, v, this, get_shard_services(), get_osdmap_epoch()); return std::move(fut); } @@ -744,14 +743,13 @@ PG::do_osd_ops_iertr::future PG::do_osd_ops_execute( }).safe_then_interruptible_tuple([success_func=std::move(success_func)] { return std::move(success_func)(); }, crimson::ct_error::object_corrupted::handle( - [m, obc, rollbacker, this] (const std::error_code& e) mutable { + [obc, rollbacker, this] (const std::error_code& e) mutable { // this is a path for EIO. it's special because we want to fix the obejct // and try again. that is, the layer above `PG::do_osd_ops` is supposed to // restart the execution. return rollbacker.rollback_obc_if_modified(e).then_interruptible( - [m, obc, this] { - return repair_object(m, - obc->obs.oi.soid, + [obc, this] { + return repair_object(obc->obs.oi.soid, obc->obs.oi.version).then_interruptible([] { return do_osd_ops_iertr::future{crimson::ct_error::eagain::make()}; }); diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index 373f92562cc5..0e1d7fe1329c 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -592,9 +592,9 @@ private: ObjectContextRef&& obc, ceph::os::Transaction&& txn, osd_op_params_t&& oop); - interruptible_future<> repair_object(Ref m, - const hobject_t& oid, - eversion_t& v); + interruptible_future<> repair_object( + const hobject_t& oid, + eversion_t& v); private: OSDMapGate osdmap_gate; -- 2.47.3