]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix break inside of yield in RGWFetchAllMetaCR 14067/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 20 Oct 2016 19:01:01 +0000 (15:01 -0400)
committerAlexey Sheplyakov <asheplyakov@mirantis.com>
Tue, 21 Mar 2017 10:50:19 +0000 (14:50 +0400)
the yield macro is implemented with for/switch, so the breaks in
RGWFetchAllMetaCR weren't being applied to the for loop as expected -
so any of these breaks send RGWFetchAllMetaCR into an infinite loop

removed the yield {} block, so that breaks will apply to the for loop as
intended, then added a single yield; statement to allow the
entries_index consumer to run one per iteration

Fixes: http://tracker.ceph.com/issues/17655
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 190bd385a7be52867d65740c410884f5c8cbc21f)

src/rgw/rgw_sync.cc

index c47dd4b7997199217d266495026d8a1308a39259..73720851fe9e1694bdab97ffdfb7d0ca3da3aee6 100644 (file)
@@ -837,27 +837,25 @@ public:
         }
         iter = result.begin();
         for (; iter != result.end(); ++iter) {
-          RGWRados *store;
-          int ret;
-          yield {
-            if (!lease_cr->is_locked()) {
-              lost_lock = true;
-              break;
-            }
-           ldout(cct, 20) << "list metadata: section=" << *sections_iter << " key=" << *iter << dendl;
-           string s = *sections_iter + ":" + *iter;
-            int shard_id;
-            store = sync_env->store;
-            ret = store->meta_mgr->get_log_shard_id(*sections_iter, *iter, &shard_id);
-            if (ret < 0) {
-              ldout(cct, 0) << "ERROR: could not determine shard id for " << *sections_iter << ":" << *iter << dendl;
-              ret_status = ret;
-              break;
-            }
-           if (!entries_index->append(s, shard_id)) {
-              break;
-            }
-         }
+          if (!lease_cr->is_locked()) {
+            lost_lock = true;
+            break;
+          }
+          yield; // allow entries_index consumer to make progress
+
+          ldout(cct, 20) << "list metadata: section=" << *sections_iter << " key=" << *iter << dendl;
+          string s = *sections_iter + ":" + *iter;
+          int shard_id;
+          RGWRados *store = sync_env->store;
+          int ret = store->meta_mgr->get_log_shard_id(*sections_iter, *iter, &shard_id);
+          if (ret < 0) {
+            ldout(cct, 0) << "ERROR: could not determine shard id for " << *sections_iter << ":" << *iter << dendl;
+            ret_status = ret;
+            break;
+          }
+          if (!entries_index->append(s, shard_id)) {
+            break;
+          }
        }
       }
       yield {