From: Yehuda Sadeh Date: Tue, 20 Mar 2018 18:47:39 +0000 (-0700) Subject: rgw: coroutines: cancel stacks on teardown X-Git-Tag: v13.1.0~270^2~12 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=057aac4516b3af9c6c515fcfb6df7df4cc3bc393;p=ceph.git rgw: coroutines: cancel stacks on teardown If we don't cancel stacks, ops might not be destructed, so ops callbacks could still be active. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_coroutine.cc b/src/rgw/rgw_coroutine.cc index 9a566ecb1a6a3..1980f372eac12 100644 --- a/src/rgw/rgw_coroutine.cc +++ b/src/rgw/rgw_coroutine.cc @@ -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(); diff --git a/src/rgw/rgw_coroutine.h b/src/rgw/rgw_coroutine.h index d61b40aae9ba5..7212a4fc84a11 100644 --- a/src/rgw/rgw_coroutine.h +++ b/src/rgw/rgw_coroutine.h @@ -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();