]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't equeue async cr rados operations if going down
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 8 Mar 2016 17:34:35 +0000 (09:34 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 8 Mar 2016 18:02:46 +0000 (10:02 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h

index 0d5fa5dd9f8ae14fb9935f078b7f550287c713f5..d37b88b25ee9985e20d60dbe94cc36182990c919 100644 (file)
@@ -8,6 +8,9 @@
 #define dout_subsys ceph_subsys_rgw
 
 bool RGWAsyncRadosProcessor::RGWWQ::_enqueue(RGWAsyncRadosRequest *req) {
+  if (processor->is_going_down()) {
+    return false;
+  }
   req->get();
   processor->m_req_queue.push_back(req);
   dout(20) << "enqueued request req=" << hex << req << dec << dendl;
@@ -61,6 +64,7 @@ void RGWAsyncRadosProcessor::start() {
 }
 
 void RGWAsyncRadosProcessor::stop() {
+  going_down.set(1);
   m_tp.drain(&req_wq);
   m_tp.stop();
   for (auto iter = m_req_queue.begin(); iter != m_req_queue.end(); ++iter) {
index 3a29b64bec08311db7a6588a810dcf4d02df0289..4ee5b5a55c4aafa99416d1fb599666ab93b2d9ff 100644 (file)
@@ -45,6 +45,7 @@ public:
 
 class RGWAsyncRadosProcessor {
   deque<RGWAsyncRadosRequest *> m_req_queue;
+  atomic_t going_down;
 protected:
   RGWRados *store;
   ThreadPool m_tp;
@@ -76,6 +77,10 @@ public:
   void stop();
   void handle_request(RGWAsyncRadosRequest *req);
   void queue(RGWAsyncRadosRequest *req);
+
+  bool is_going_down() {
+    return (going_down.read() != 0);
+  }
 };