]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/rgw: keep issuing bilog trim ops after reset 29326/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 5 Jun 2019 21:07:47 +0000 (17:07 -0400)
committerNathan Cutler <ncutler@suse.com>
Thu, 25 Jul 2019 16:13:02 +0000 (18:13 +0200)
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 <cbodley@redhat.com>
(cherry picked from commit a6ea8433fe9eb032180368bc3d36a4232dd6d08b)

src/cls/rgw/cls_rgw_client.h

index dcfab4121e7054c1ef9c7a95b2789f57c2412c57..b090fbd74787f18af0ee8c2ba8c66dfae2bd00c3 100644 (file)
@@ -276,14 +276,14 @@ public:
         break;
     }
 
-    int num_completions, r = 0;
+    int num_completions = 0, r = 0;
     map<int, string> objs;
     map<int, string> *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;
+          }
+        }
       }
     }