]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: coroutine drain fixes
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 30 Oct 2015 22:19:35 +0000 (15:19 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:26 +0000 (16:13 -0800)
Init drain_cr() before draining, otherwise we wouldn't be able to
call it a second time

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_coroutine.cc
src/rgw/rgw_coroutine.h

index 957e91a62dc5e151d0669fa4dde25d8d04968a0b..6916c12189b86616bbbeb7bf63a3f59f70b3afb6 100644 (file)
@@ -241,6 +241,7 @@ bool RGWCoroutinesStack::collect(RGWCoroutine *op, int *ret) /* returns true if
     RGWCoroutinesStack *stack = *iter;
     if (!stack->is_done()) {
       new_list.push_back(stack);
+      ldout(cct, 20) << "collect(): s=" << (void *)this << " stack=" << (void *)stack << " is still running" << dendl;
       continue;
     }
     int r = stack->get_ret_status();
@@ -248,6 +249,7 @@ bool RGWCoroutinesStack::collect(RGWCoroutine *op, int *ret) /* returns true if
       *ret = r;
     }
 
+    ldout(cct, 20) << "collect(): s=" << (void *)this << " stack=" << (void *)stack << " is complete" << dendl;
     stack->put();
   }
 
@@ -259,7 +261,6 @@ bool RGWCoroutinesStack::collect_next(RGWCoroutine *op, int *ret, RGWCoroutinesS
 {
   rgw_spawned_stacks *s = (op ? &op->spawned : &spawned);
   *ret = 0;
-  vector<RGWCoroutinesStack *> new_list;
 
   if (collected_stack) {
     *collected_stack = NULL;
@@ -277,9 +278,8 @@ bool RGWCoroutinesStack::collect_next(RGWCoroutine *op, int *ret, RGWCoroutinesS
 
     if (collected_stack) {
       *collected_stack = stack;
-    } else {
-      stack->put();
     }
+    stack->put();
 
     s->entries.erase(iter);
     return true;
index 74f2bb32c402d380aba8bf04e09053dffe7a1657..5abbf9a5fc4cafdcba3fe8cb4aef4a51b66ec055 100644 (file)
@@ -214,9 +214,11 @@ do {                            \
 } while (0)
 
 #define drain_all() \
+  drain_cr = boost::asio::coroutine(); \
   yield_until_true(drain_children(0))
 
 #define drain_all_but(n) \
+  drain_cr = boost::asio::coroutine(); \
   yield_until_true(drain_children(n))
 
 template <class T>