From: Yehuda Sadeh Date: Wed, 20 Jul 2016 19:42:52 +0000 (-0700) Subject: rgw: collect() stops if error encoutered X-Git-Tag: v10.2.4~111^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bce19a39b6f6ff23b6373f82ed2e6e12d65a77ef;p=ceph.git rgw: collect() stops if error encoutered and returns true if needed to be called again Signed-off-by: Yehuda Sadeh (cherry picked from commit 5528932e4c327a0fb0ce34a676eb59707a575325) --- diff --git a/src/rgw/rgw_coroutine.cc b/src/rgw/rgw_coroutine.cc index 2e478f23850..455c178478e 100644 --- a/src/rgw/rgw_coroutine.cc +++ b/src/rgw/rgw_coroutine.cc @@ -294,6 +294,7 @@ int RGWCoroutinesStack::unwind(int retcode) bool RGWCoroutinesStack::collect(RGWCoroutine *op, int *ret, RGWCoroutinesStack *skip_stack) /* returns true if needs to be called again */ { + bool done = true; rgw_spawned_stacks *s = (op ? &op->spawned : &spawned); *ret = 0; vector new_list; @@ -302,20 +303,28 @@ bool RGWCoroutinesStack::collect(RGWCoroutine *op, int *ret, RGWCoroutinesStack RGWCoroutinesStack *stack = *iter; if (stack == skip_stack || !stack->is_done()) { new_list.push_back(stack); - ldout(cct, 20) << "collect(): s=" << (void *)this << " stack=" << (void *)stack << " is still running" << dendl; + if (!stack->is_done()) { + ldout(cct, 20) << "collect(): s=" << (void *)this << " stack=" << (void *)stack << " is still running" << dendl; + } else if (stack == skip_stack) { + ldout(cct, 20) << "collect(): s=" << (void *)this << " stack=" << (void *)stack << " explicitily skipping stack" << dendl; + } continue; } int r = stack->get_ret_status(); + stack->put(); if (r < 0) { *ret = r; + ldout(cct, 20) << "collect(): s=" << (void *)this << " stack=" << (void *)stack << " encountered error (r=" << r << "), skipping next stacks" << dendl; + new_list.insert(new_list.end(), ++iter, s->entries.end()); + done &= (iter != s->entries.end()); + break; } ldout(cct, 20) << "collect(): s=" << (void *)this << " stack=" << (void *)stack << " is complete" << dendl; - stack->put(); } s->entries.swap(new_list); - return false; + return (!done); } bool RGWCoroutinesStack::collect_next(RGWCoroutine *op, int *ret, RGWCoroutinesStack **collected_stack) /* returns true if found a stack to collect */