From 7a1eb3d4c5401962bc9176952d5863202a59a37d Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Tue, 17 Sep 2019 20:33:00 +0200 Subject: [PATCH] crimson/osd: apply errorator to do_op_call() path. Signed-off-by: Radoslaw Zarzynski --- src/crimson/osd/ops_executer.cc | 15 ++++++++++++--- src/crimson/osd/ops_executer.h | 4 +++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/crimson/osd/ops_executer.cc b/src/crimson/osd/ops_executer.cc index 864d0e2f1a2..3646989462a 100644 --- a/src/crimson/osd/ops_executer.cc +++ b/src/crimson/osd/ops_executer.cc @@ -26,7 +26,7 @@ namespace { namespace crimson::osd { -seastar::future<> OpsExecuter::do_op_call(OSDOp& osd_op) +OpsExecuter::call_errorator::future<> OpsExecuter::do_op_call(OSDOp& osd_op) { std::string cname, mname; ceph::bufferlist indata; @@ -96,9 +96,13 @@ seastar::future<> OpsExecuter::do_op_call(OSDOp& osd_op) osd_op.op.extent.length = outdata.length(); osd_op.outdata.claim_append(outdata); } + return ret; + }).then([] (const int ret) { if (ret < 0) { - throw crimson::osd::make_error(ret); + return call_errorator::make_plain_exception_future<>( + ceph::stateful_errint{ ret }); } + return seastar::now(); }); } @@ -407,7 +411,12 @@ OpsExecuter::execute_osd_op(OSDOp& osd_op) return backend.remove(os, txn); }); case CEPH_OSD_OP_CALL: - return this->do_op_call(osd_op); + return this->do_op_call(osd_op).safe_then( + [] { + return seastar::now(); + }, ceph::stateful_errint::handle([] (int err) { + // TODO: implement the handler. NOP for now. + })); case CEPH_OSD_OP_STAT: // note: stat does not require RD return do_const_op([&osd_op] (/* const */auto& backend, const auto& os) { diff --git a/src/crimson/osd/ops_executer.h b/src/crimson/osd/ops_executer.h index 4c4fa9415b2..f644520be43 100644 --- a/src/crimson/osd/ops_executer.h +++ b/src/crimson/osd/ops_executer.h @@ -19,6 +19,7 @@ #include "osd/osd_types.h" #include "osd/osd_internal_types.h" +#include "crimson/common/errorator.h" #include "crimson/common/type_helpers.h" #include "crimson/osd/osd_operations/client_request.h" #include "crimson/osd/osd_operations/peering_event.h" @@ -64,7 +65,8 @@ class OpsExecuter { template auto with_effect(Context&& ctx, MainFunc&& main_func, EffectFunc&& effect_func); - seastar::future<> do_op_call(class OSDOp& osd_op); + using call_errorator = ceph::errorator; + call_errorator::future<> do_op_call(class OSDOp& osd_op); template auto do_const_op(Func&& f) { -- 2.39.5