From: Yehuda Sadeh Date: Tue, 8 Mar 2016 17:34:35 +0000 (-0800) Subject: rgw: don't equeue async cr rados operations if going down X-Git-Tag: v10.1.0~143^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ea29b71166c85003a6cef71b6f0f0dd9d197078e;p=ceph.git rgw: don't equeue async cr rados operations if going down Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index 0d5fa5dd9f8a..d37b88b25ee9 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -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) { diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index 3a29b64bec08..4ee5b5a55c4a 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -45,6 +45,7 @@ public: class RGWAsyncRadosProcessor { deque 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); + } };