]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Drain async_processor request queue during shutdown 53472/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>
Sat, 14 Oct 2023 07:58:28 +0000 (14:58 +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 4b1cb1c45e2a00c65ab943da5378d676e983fcc9..349b41c7e8b5e697a12fa865d9bb39c2158975ac 100644 (file)
@@ -1028,6 +1028,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 32a6b3a3e39ad2e74c4b841d001abc64562c13b3..5949917e9d3b09ad027ad1fb650f53d27584349f 100644 (file)
@@ -45,6 +45,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 d3fa393140b8d932071e3e4e42a394d5cfe40f5d..0a6e262ece49c432c46d734fc04056300d06d2f4 100644 (file)
@@ -66,6 +66,7 @@ public:
 
   void init() {}
   void shutdown() override;
+  void stop_processor();
 
   uint64_t instance_id();
   bool check_secure_mon_conn() const;