From a8b28d69de9e1a54dfeb9c4a02db45359479052e Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Wed, 6 Sep 2023 12:09:49 +0000 Subject: [PATCH] crimson/osd/pg: do_osd_ops_execute refactor pt. 2 be more explicit around returned futures, no change in behavior. Signed-off-by: Matan Breizman --- src/crimson/osd/pg.cc | 55 +++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 0c1ed5b863c..6ba56b36e4e 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -872,33 +872,36 @@ PG::do_osd_ops_execute( }); }).safe_then_unpack_interruptible( [success_func=std::move(success_func), rollbacker, this, failure_func_ptr] - (auto submitted_fut, auto all_completed_fut) mutable { + (auto submitted_fut, auto _all_completed_fut) mutable { + + auto all_completed_fut = _all_completed_fut.safe_then_interruptible_tuple( + std::move(success_func), + crimson::ct_error::object_corrupted::handle( + [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( + [obc=rollbacker.get_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()}; + }); + }); + }), OpsExecuter::osd_op_errorator::all_same_way( + [rollbacker, failure_func_ptr] + (const std::error_code& e) mutable { + return rollbacker.rollback_obc_if_modified(e).then_interruptible( + [e, failure_func_ptr] { + return (*failure_func_ptr)(e); + }); + })); + return PG::do_osd_ops_iertr::make_ready_future>( - std::move(submitted_fut), - all_completed_fut.safe_then_interruptible_tuple( - std::move(success_func), - crimson::ct_error::object_corrupted::handle( - [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( - [obc=rollbacker.get_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()}; - }); - }); - }), OpsExecuter::osd_op_errorator::all_same_way( - [rollbacker, failure_func_ptr] - (const std::error_code& e) mutable { - return rollbacker.rollback_obc_if_modified(e).then_interruptible( - [e, failure_func_ptr] { - return (*failure_func_ptr)(e); - }); - }) - ) - ); + std::move(submitted_fut), + std::move(all_completed_fut) + ); }, OpsExecuter::osd_op_errorator::all_same_way( [rollbacker, failure_func_ptr] (const std::error_code& e) mutable { -- 2.39.5