]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: stop meta sync handler when going down
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 12 Jan 2016 01:09:29 +0000 (17:09 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:53 +0000 (16:13 -0800)
it needed to check internally whether it was going down

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_coroutine.cc
src/rgw/rgw_sync.cc
src/rgw/rgw_sync.h

index 40fb83d6280ef450fabaa6d65193d2e17c643078..7738832dcf86d6d0ba87e248dd94951ae05c7704 100644 (file)
@@ -410,6 +410,7 @@ void RGWCoroutinesManager::schedule(RGWCoroutinesEnv *env, RGWCoroutinesStack *s
 
 int RGWCoroutinesManager::run(list<RGWCoroutinesStack *>& stacks)
 {
+  int ret = 0;
   int blocked_count = 0;
   int interval_wait_count = 0;
   RGWCoroutinesEnv env;
@@ -504,7 +505,7 @@ int RGWCoroutinesManager::run(list<RGWCoroutinesStack *>& stacks)
      * these aren't really waiting for IOs
      */
     while (blocked_count - interval_wait_count >= ops_window) {
-      int ret = completion_mgr.get_next((void **)&blocked_stack);
+      ret = completion_mgr.get_next((void **)&blocked_stack);
       if (ret < 0) {
        ldout(cct, 0) << "ERROR: failed to clone shard, completion_mgr.get_next() returned ret=" << ret << dendl;
       }
@@ -516,13 +517,14 @@ int RGWCoroutinesManager::run(list<RGWCoroutinesStack *>& stacks)
 
 
     while (scheduled_stacks.empty() && blocked_count > 0) {
-      int ret = completion_mgr.get_next((void **)&blocked_stack);
+      ret = completion_mgr.get_next((void **)&blocked_stack);
       if (ret < 0) {
        ldout(cct, 0) << "ERROR: failed to clone shard, completion_mgr.get_next() returned ret=" << ret << dendl;
       }
       if (going_down.read() > 0) {
        ldout(cct, 5) << __func__ << "(): was stopped, exiting" << dendl;
-       return -ECANCELED;
+       ret = -ECANCELED;
+        break;
       }
       handle_unblocked_stack(context_stacks, scheduled_stacks, blocked_stack, &blocked_count);
       iter = scheduled_stacks.begin();
@@ -531,6 +533,8 @@ int RGWCoroutinesManager::run(list<RGWCoroutinesStack *>& stacks)
     if (iter == scheduled_stacks.end()) {
       iter = scheduled_stacks.begin();
     }
+
+    ret = 0;
   }
 
   lock.get_write();
@@ -541,7 +545,7 @@ int RGWCoroutinesManager::run(list<RGWCoroutinesStack *>& stacks)
   run_contexts.erase(run_context);
   lock.unlock();
 
-  return 0;
+  return ret;
 }
 
 int RGWCoroutinesManager::run(RGWCoroutine *op)
index f2d87a7f82d17f365e52b892747a3dfbe47d7ade..a3d421857dd6729e939f4d1a04bfea390686f7c0 100644 (file)
@@ -172,6 +172,7 @@ int RGWRemoteMetaLog::init()
 
 void RGWRemoteMetaLog::finish()
 {
+  going_down.set(1);
   stop();
   if (async_rados) {
     async_rados->stop();
@@ -1717,7 +1718,7 @@ int RGWRemoteMetaLog::run_sync(int num_shards, rgw_meta_sync_status& sync_status
         ldout(store->ctx(), 0) << "ERROR: bad sync state!" << dendl;
         return -EIO;
     }
-  } while (true);
+  } while (!going_down.read());
 
   return 0;
 }
index e386329f4f59ac73c28f97aa7828141f1d23c36b..787217dbcc9dbdfffbb0791f6dd789d6a2ea5b4b 100644 (file)
@@ -108,6 +108,8 @@ class RGWRemoteMetaLog : public RGWCoroutinesManager {
 
   void init_sync_env(RGWMetaSyncEnv *env);
 
+  atomic_t going_down;
+
 public:
   RGWRemoteMetaLog(RGWRados *_store, RGWMetaSyncStatusManager *_sm) : RGWCoroutinesManager(_store->ctx(), _store->get_cr_registry()), store(_store),
                                        conn(NULL), async_rados(nullptr),