From ea29b71166c85003a6cef71b6f0f0dd9d197078e Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 8 Mar 2016 09:34:35 -0800 Subject: [PATCH] rgw: don't equeue async cr rados operations if going down Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_cr_rados.cc | 4 ++++ src/rgw/rgw_cr_rados.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index 0d5fa5dd9f8..d37b88b25ee 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 3a29b64bec0..4ee5b5a55c4 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); + } }; -- 2.47.3