]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: reorder RGWRados::finalize()
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 7 Mar 2016 23:25:39 +0000 (15:25 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 8 Mar 2016 18:02:47 +0000 (10:02 -0800)
first stop all sync threads, then delete them. Might be referencing
each other.

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

index 40fdb0cae5e78a4db1f338471d3f895eb76438ae..1046a91b0cfc0d7d6523963198f4ce25bc64a2af 100644 (file)
@@ -558,6 +558,7 @@ void RGWHTTPManager::stop()
 {
   if (is_threaded) {
     going_down.set(1);
+    signal_thread();
     reqs_thread->join();
     delete reqs_thread;
   }
index f0e15226b5ad80f8598f0939813f78269d5c0ad2..8f45ad7e91deef5a834a47df7c3ac5baf8fdb8a3 100644 (file)
@@ -3065,20 +3065,25 @@ int RGWRados::get_max_chunk_size(rgw_bucket& bucket, uint64_t *max_chunk_size)
 
 void RGWRados::finalize()
 {
+  if (run_sync_thread) {
+    Mutex::Locker l(meta_sync_thread_lock);
+    meta_sync_processor_thread->stop();
+
+    Mutex::Locker dl(data_sync_thread_lock);
+    for (auto iter : data_sync_processor_threads) {
+      RGWDataSyncProcessorThread *thread = iter.second;
+      thread->stop();
+    }
+  }
   if (async_rados) {
     async_rados->stop();
   }
   if (run_sync_thread) {
-    Mutex::Locker l(meta_sync_thread_lock);
-    meta_sync_processor_thread->stop();
     delete meta_sync_processor_thread;
     meta_sync_processor_thread = NULL;
-
     Mutex::Locker dl(data_sync_thread_lock);
-    map<string, RGWDataSyncProcessorThread *>::iterator iter = data_sync_processor_threads.begin();
-    for (; iter != data_sync_processor_threads.end(); ++iter) {
-      RGWDataSyncProcessorThread *thread = iter->second;
-      thread->stop();
+    for (auto iter : data_sync_processor_threads) {
+      RGWDataSyncProcessorThread *thread = iter.second;
       delete thread;
     }
     data_sync_processor_threads.clear();