From a1abe968416a39b9642301808f6548be8a57435c Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 6 Aug 2015 16:11:34 -0700 Subject: [PATCH] rgw: return retcode of failing coroutine Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_sync.cc | 8 ++++++++ src/rgw/rgw_sync.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index c0a27fb53f5b3..6eef00f2bb1a7 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -593,6 +593,7 @@ template int RGWSimpleRadosCoroutine::request_complete() { int ret = req->get_ret_status(); + retcode = ret; if (ret != -ENOENT) { if (ret < 0) { return ret; @@ -633,6 +634,9 @@ public: int RGWReadSyncStatusCoroutine::handle_data(RGWMetaSyncGlobalStatus& data) { + if (retcode == -ENOENT) { + return retcode; + } spawn(new RGWSimpleRadosCoroutine(async_rados, store, obj_ctx, store->get_zone_params().log_pool, "mdlog.state.0", &sync_marker)); spawn(new RGWSimpleRadosCoroutine(async_rados, store, obj_ctx, store->get_zone_params().log_pool, @@ -965,6 +969,7 @@ int RGWCoroutinesManager::run(RGWCoroutine *op) { list stacks; RGWCoroutinesStack *stack = allocate_stack(); + op->get(); int r = stack->call(op); if (r < 0) { ldout(cct, 0) << "ERROR: stack->call() returned r=" << r << dendl; @@ -978,6 +983,9 @@ int RGWCoroutinesManager::run(RGWCoroutine *op) ldout(cct, 0) << "ERROR: run(stacks) returned r=" << r << dendl; } + r = op->get_ret_status(); + op->put(); + return r; } diff --git a/src/rgw/rgw_sync.h b/src/rgw/rgw_sync.h index 39570bd93a2bc..e0922bb28a853 100644 --- a/src/rgw/rgw_sync.h +++ b/src/rgw/rgw_sync.h @@ -77,6 +77,10 @@ public: void set_retcode(int r) { retcode = r; } + + int get_ret_status() { + return retcode; + } }; class RGWCoroutinesStack { -- 2.39.5