]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Clean up lifecycle thread
authorDaniel Gryniewicz <dang@redhat.com>
Thu, 28 Jul 2016 18:39:07 +0000 (14:39 -0400)
committerDaniel Gryniewicz <dang@redhat.com>
Fri, 29 Jul 2016 15:34:21 +0000 (11:34 -0400)
Make sure that the lifecycle thread is terminated and all memory is
cleaned up on shutdown.

Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
src/rgw/rgw_lc.cc
src/rgw/rgw_lc.h
src/rgw/rgw_rados.cc

index 0e8df5ed333dd9a6e749f1b186945fd9323f515b..8876f6330ce476c6390ebab02429fe26838a1706 100644 (file)
@@ -474,6 +474,7 @@ void RGWLC::start_processor()
 
 void RGWLC::stop_processor()
 {
+  down_flag.set(1);
   if (worker) {
     worker->stop();
     worker->join();
@@ -490,7 +491,7 @@ void RGWLC::LCWorker::stop()
 
 bool RGWLC::going_down()
 {
-  return false;
+  return (down_flag.read() != 0);
 }
 
 bool RGWLC::LCWorker::should_work(utime_t& now)
index 0c4126c1ece8bee47696039dfd1a7e1accc62182..30d2f2b02237166907ea95107795c5ccfed01c36 100644 (file)
@@ -179,6 +179,7 @@ class RGWLC {
   RGWRados *store;
   int max_objs;
   string *obj_names;
+  atomic_t down_flag;
 
   class LCWorker : public Thread {
     CephContext *cct;
index f25592a7198f2794b1c066b99947107868224ed0..3e0a55b04496f7abb279d63da52bff7c9cfe18c8 100644 (file)
@@ -3176,6 +3176,12 @@ void RGWRados::finalize()
   delete gc;
   gc = NULL;
 
+  if (use_lc_thread) {
+    lc->stop_processor();
+  }
+  delete lc;
+  lc = NULL;
+
   delete obj_expirer;
   obj_expirer = NULL;