From: Casey Bodley Date: Wed, 5 Jun 2019 21:07:47 +0000 (-0400) Subject: cls/rgw: keep issuing bilog trim ops after reset X-Git-Tag: v14.2.3~29^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4c4def2fc34e71b002b5809410b9ccb44d54750e;p=ceph.git cls/rgw: keep issuing bilog trim ops after reset The CLSRGWIssueBILogTrim class is intended to keep submitting cls_log_trim operations on each bucket index shard until they return -ENODATA to signal there's no more to trim. However, if the while loop in CLSRGWConcurrentIO::operator() gets to the end of the shard list and collects all of its completions, wait_for_completions() will return false and exit the loop. This is always the case when num_shards = 1. Fixes: http://tracker.ceph.com/issues/40187 Signed-off-by: Casey Bodley (cherry picked from commit a6ea8433fe9eb032180368bc3d36a4232dd6d08b) --- diff --git a/src/cls/rgw/cls_rgw_client.h b/src/cls/rgw/cls_rgw_client.h index dcfab4121e70..b090fbd74787 100644 --- a/src/cls/rgw/cls_rgw_client.h +++ b/src/cls/rgw/cls_rgw_client.h @@ -276,14 +276,14 @@ public: break; } - int num_completions, r = 0; + int num_completions = 0, r = 0; map objs; map *pobjs = (need_multiple_rounds() ? &objs : NULL); while (manager.wait_for_completions(valid_ret_code(), &num_completions, &r, pobjs)) { if (r >= 0 && ret >= 0) { - for(int i = 0; i < num_completions && iter != objs_container.end(); ++i, ++iter) { + for (; num_completions && iter != objs_container.end(); --num_completions, ++iter) { int issue_ret = issue_op(iter->first, iter->second); - if(issue_ret < 0) { + if (issue_ret < 0) { ret = issue_ret; break; } @@ -295,6 +295,14 @@ public: // For those objects which need another round, use them to reset // the container reset_container(objs); + iter = objs_container.begin(); + for (; num_completions && iter != objs_container.end(); --num_completions, ++iter) { + int issue_ret = issue_op(iter->first, iter->second); + if (issue_ret < 0) { + ret = issue_ret; + break; + } + } } }