From 46f1ee548db220856e41e3b341d04b0581ab846e Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 7 Jan 2016 16:17:12 -0800 Subject: [PATCH] rgw: more leak fixes Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_coroutine.cc | 9 +++++++++ src/rgw/rgw_coroutine.h | 2 +- src/rgw/rgw_data_sync.cc | 7 ++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_coroutine.cc b/src/rgw/rgw_coroutine.cc index 107102848f2..62b8c9f4f6c 100644 --- a/src/rgw/rgw_coroutine.cc +++ b/src/rgw/rgw_coroutine.cc @@ -90,6 +90,11 @@ void RGWCompletionManager::_wakeup(void *opaque) } } +RGWCoroutine::~RGWCoroutine() { + for (auto stack : spawned.entries) { + stack->put(); + } +} void RGWCoroutine::set_io_blocked(bool flag) { stack->set_io_blocked(flag); @@ -142,6 +147,10 @@ RGWCoroutinesStack::~RGWCoroutinesStack() for (auto op : ops) { op->put(); } + + for (auto stack : spawned.entries) { + stack->put(); + } } int RGWCoroutinesStack::operate(RGWCoroutinesEnv *_env) diff --git a/src/rgw/rgw_coroutine.h b/src/rgw/rgw_coroutine.h index c976ed7e3fc..1815fa8ab0a 100644 --- a/src/rgw/rgw_coroutine.h +++ b/src/rgw/rgw_coroutine.h @@ -207,7 +207,7 @@ protected: public: RGWCoroutine(CephContext *_cct) : status(_cct), _yield_ret(false), cct(_cct), stack(NULL), retcode(0), state(RGWCoroutine_Run) {} - virtual ~RGWCoroutine() {} + virtual ~RGWCoroutine(); virtual int operate() = 0; diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index cfe1199403e..8b837cbcb46 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -65,7 +65,7 @@ class RGWReadDataSyncStatusCoroutine : public RGWSimpleRadosReadCR crs; + list *> crs; public: RGWReadDataSyncStatusCoroutine(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store, @@ -94,8 +94,9 @@ int RGWReadDataSyncStatusCoroutine::handle_data(rgw_data_sync_info& data) map& markers = sync_status->sync_markers; for (int i = 0; i < (int)data.num_shards; i++) { - RGWCoroutinesStack *cr = spawn(new RGWSimpleRadosReadCR(async_rados, store, obj_ctx, store->get_zone_params().log_pool, - RGWDataSyncStatusManager::shard_obj_name(source_zone, i), &markers[i]), true); + RGWSimpleRadosReadCR *cr = new RGWSimpleRadosReadCR(async_rados, store, obj_ctx, store->get_zone_params().log_pool, + RGWDataSyncStatusManager::shard_obj_name(source_zone, i), &markers[i]); + spawn(cr, true); crs.push_back(cr); } return 0;