From: Yehuda Sadeh Date: Sat, 9 Jan 2016 00:02:37 +0000 (-0800) Subject: rgw: more leak fixes X-Git-Tag: v10.1.0~354^2~63 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=efc2dfcc644bdc66f439986857fe49917b39ccf3;p=ceph.git rgw: more leak fixes Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_coroutine.cc b/src/rgw/rgw_coroutine.cc index 4959a893eea..40fb83d6280 100644 --- a/src/rgw/rgw_coroutine.cc +++ b/src/rgw/rgw_coroutine.cc @@ -208,7 +208,6 @@ RGWCoroutinesStack *RGWCoroutinesStack::spawn(RGWCoroutine *source_op, RGWCorout if (!op) { return NULL; } - op->get(); rgw_spawned_stacks *s = (source_op ? &source_op->spawned : &spawned); @@ -481,13 +480,14 @@ int RGWCoroutinesManager::run(list& stacks) } context_stacks.erase(stack); stack->put(); + stack = NULL; } else { op_not_blocked = true; stack->run_count++; stack->schedule(); } - if (!op_not_blocked) { + if (!op_not_blocked && stack) { stack->run_count = 0; } @@ -535,6 +535,7 @@ int RGWCoroutinesManager::run(list& stacks) lock.get_write(); for (auto stack : context_stacks) { + ldout(cct, 20) << "clearing stack on run() exit: stack=" << (void *)stack << " nref=" << stack->get_nref() << dendl; stack->put(); } run_contexts.erase(run_context); @@ -589,9 +590,7 @@ void RGWCoroutinesManager::dump(Formatter *f) const { } RGWCoroutinesStack *RGWCoroutinesManager::allocate_stack() { - RGWCoroutinesStack *stack = new RGWCoroutinesStack(cct, this); - stack->get(); - return stack; + return new RGWCoroutinesStack(cct, this); } string RGWCoroutinesManager::get_id() diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 8b837cbcb46..66045a06f73 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -65,8 +65,6 @@ class RGWReadDataSyncStatusCoroutine : public RGWSimpleRadosReadCR *> crs; - public: RGWReadDataSyncStatusCoroutine(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store, RGWObjectCtx& _obj_ctx, const string& _source_zone, @@ -78,11 +76,6 @@ public: obj_ctx(_obj_ctx), source_zone(_source_zone), sync_status(_status) {} - ~RGWReadDataSyncStatusCoroutine() { - for (auto cr : crs) { - cr->put(); - } - } int handle_data(rgw_data_sync_info& data); }; @@ -94,10 +87,8 @@ 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++) { - 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); + spawn(new RGWSimpleRadosReadCR(async_rados, store, obj_ctx, store->get_zone_params().log_pool, + RGWDataSyncStatusManager::shard_obj_name(source_zone, i), &markers[i]), true); } return 0; } @@ -1251,7 +1242,6 @@ int RGWRemoteDataLog::run_sync(int num_shards, rgw_data_sync_status& sync_status lock.get_write(); data_sync_cr = new RGWDataSyncControlCR(store, &http_manager, async_rados, conn, source_zone, num_shards); - data_sync_cr->get(); lock.unlock(); r = run(data_sync_cr); if (r < 0) {