From 6d0f18d0e56d28451bbe379b1ee7a83ee8b70ce7 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 29 Jan 2021 17:12:18 -0500 Subject: [PATCH] rgw: RGWCoroutine::drain_children() checks errors on last stack collect() returns false when it gets to the last stack. but it always collects one result, so we need to check for errors even when it returns false Signed-off-by: Casey Bodley --- src/rgw/rgw_coroutine.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_coroutine.cc b/src/rgw/rgw_coroutine.cc index ce08bdd30cb85..6278d695147b9 100644 --- a/src/rgw/rgw_coroutine.cc +++ b/src/rgw/rgw_coroutine.cc @@ -973,7 +973,9 @@ bool RGWCoroutine::drain_children(int num_cr_left, yield wait_for_child(); int ret; uint64_t stack_id; - while (collect(&ret, skip_stack, &stack_id)) { + bool again = false; + do { + again = collect(&ret, skip_stack, &stack_id); if (ret < 0) { ldout(cct, 10) << "collect() returned ret=" << ret << dendl; /* we should have reported this error */ @@ -982,7 +984,7 @@ bool RGWCoroutine::drain_children(int num_cr_left, if (cb) { (*cb)(stack_id, ret); } - } + } while (again); } done = true; } @@ -1000,7 +1002,9 @@ bool RGWCoroutine::drain_children(int num_cr_left, yield wait_for_child(); int ret; uint64_t stack_id; - while (collect(&ret, nullptr, &stack_id)) { + bool again = false; + do { + again = collect(&ret, nullptr, &stack_id); if (ret < 0) { ldout(cct, 10) << "collect() returned ret=" << ret << dendl; /* we should have reported this error */ @@ -1014,7 +1018,7 @@ bool RGWCoroutine::drain_children(int num_cr_left, num_cr_left = 0; /* need to drain all */ } } - } + } while (again); } done = true; } -- 2.39.5