]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: more leak fixes
authorYehuda Sadeh <yehuda@redhat.com>
Sat, 9 Jan 2016 00:02:37 +0000 (16:02 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:53 +0000 (16:13 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_coroutine.cc
src/rgw/rgw_data_sync.cc

index 4959a893eeafed5a9326e31a87ee8b9e0a47ce80..40fb83d6280ef450fabaa6d65193d2e17c643078 100644 (file)
@@ -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<RGWCoroutinesStack *>& 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<RGWCoroutinesStack *>& 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()
index 8b837cbcb4623f210d88ff979a369f7ef15c0c77..66045a06f73e08323c46ac7a618e96e1bdbcc380 100644 (file)
@@ -65,8 +65,6 @@ class RGWReadDataSyncStatusCoroutine : public RGWSimpleRadosReadCR<rgw_data_sync
 
   rgw_data_sync_status *sync_status;
 
-  list<RGWSimpleRadosReadCR<rgw_data_sync_marker> *> 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<uint32_t, rgw_data_sync_marker>& markers = sync_status->sync_markers;
   for (int i = 0; i < (int)data.num_shards; i++) {
-    RGWSimpleRadosReadCR<rgw_data_sync_marker> *cr = new RGWSimpleRadosReadCR<rgw_data_sync_marker>(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<rgw_data_sync_marker>(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) {