]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Drain async_processor request queue during shutdown 53471/head
authorroot <root@rhs-srv-14.storage-dev.lab.eng.bos.redhat.com>
Thu, 8 Sep 2022 16:21:50 +0000 (12:21 -0400)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Thu, 14 Sep 2023 19:00:17 +0000 (02:00 +0700)
Drain outstanding requests from the async_processor before stopping
the sync threads to avoid any use-after-free of their local variables.

Fixes: https://tracker.ceph.com/issues/49666
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
(cherry picked from commit 9b451763ff583f25c821aecf3446884c0fb95273)

src/rgw/rgw_rados.cc
src/rgw/services/svc_rados.cc
src/rgw/services/svc_rados.h

index 958fe5d4538faec73da0bf44b8d04c92c4049471..85cc86bf34a01904068cb3ba717967243814782c 100644 (file)
@@ -1032,6 +1032,12 @@ bool RGWIndexCompletionManager::handle_completion(completion_t cb, complete_op_d
 
 void RGWRados::finalize()
 {
+  /* Before joining any sync threads, drain outstanding requests &
+   * mark the async_processor as going_down() */
+  if (svc.rados) {
+    svc.rados->stop_processor();
+  }
+
   if (run_sync_thread) {
     std::lock_guard l{meta_sync_thread_lock};
     meta_sync_processor_thread->stop();
index 7cba3863a50944c58762255c605bf1a541998648..1617a2ec6c611ffcc78d620b1aff416d5404b256 100644 (file)
@@ -47,6 +47,13 @@ void RGWSI_RADOS::shutdown()
   }
 }
 
+void RGWSI_RADOS::stop_processor()
+{
+  if (async_processor) {
+    async_processor->stop();
+  }
+}
+
 librados::Rados* RGWSI_RADOS::get_rados_handle()
 {
   return &rados;
index 2792d748bc5b6c8e894c0fef180459e78bae46c1..8383aaab40c6c31ba345d158e87249821dc33361 100644 (file)
@@ -66,6 +66,7 @@ public:
 
   void init() {}
   void shutdown() override;
+  void stop_processor();
 
   std::string cluster_fsid();
   uint64_t instance_id();