]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: coroutines: cancel stacks on teardown
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 20 Mar 2018 18:47:39 +0000 (11:47 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 12 Apr 2018 22:38:40 +0000 (15:38 -0700)
If we don't cancel stacks, ops might not be destructed, so ops callbacks
could still be active.

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

index 9a566ecb1a6a3cc1089fd821b0d0aad0cea1947a..1980f372eac124b886cbc2af601a27c817e0c519 100644 (file)
@@ -347,6 +347,15 @@ int RGWCoroutinesStack::unwind(int retcode)
   return 0;
 }
 
+void RGWCoroutinesStack::cancel()
+{
+  while (!ops.empty()) {
+    RGWCoroutine *op = *pos;
+    unwind(-ECANCELED);
+    op->put();
+  }
+  put();
+}
 
 bool RGWCoroutinesStack::collect(RGWCoroutine *op, int *ret, RGWCoroutinesStack *skip_stack) /* returns true if needs to be called again */
 {
@@ -730,7 +739,7 @@ next:
 
   for (auto stack : context_stacks) {
     ldout(cct, 20) << "clearing stack on run() exit: stack=" << (void *)stack << " nref=" << stack->get_nref() << dendl;
-    stack->put();
+    stack->cancel();
   }
   run_contexts.erase(run_context);
   lock.unlock();
index d61b40aae9ba56dc20fb4b18cd62b635716e87bc..7212a4fc84a11b3ad2d2c0b3c1fd1ed253960d22 100644 (file)
@@ -476,6 +476,8 @@ public:
 
   bool collect(int *ret, RGWCoroutinesStack *skip_stack); /* returns true if needs to be called again */
 
+  void cancel();
+
   RGWAioCompletionNotifier *create_completion_notifier();
   RGWCompletionManager *get_completion_mgr();