]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: services shutdown
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Oct 2018 22:38:23 +0000 (15:38 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 8 Nov 2018 17:19:29 +0000 (09:19 -0800)
Explicitly make sure services are being shut down in appropriate order.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc
src/rgw/rgw_service.cc
src/rgw/rgw_service.h

index 675dd41a1124652cc7abd49768d61ca501ff9d1f..d82398ea280f9c569ef3e9f8fdf1d8cdf67c23b2 100644 (file)
@@ -1366,6 +1366,8 @@ void RGWRados::finalize()
   }
   delete reshard;
   delete index_completion_manager;
+
+  svc.shutdown();
 }
 
 /** 
index 1c4c04dd70d3a937645b50e2fb5a8db67f78aba8..9324d6418150d26cd3ca5b1dff00528d07f2a25c 100644 (file)
 
 
 RGWServices_Def::RGWServices_Def() = default;
-RGWServices_Def::~RGWServices_Def() = default;
+RGWServices_Def::~RGWServices_Def()
+{
+  shutdown();
+}
 
 int RGWServices_Def::init(CephContext *cct,
                          bool have_cache)
@@ -112,6 +115,27 @@ int RGWServices_Def::init(CephContext *cct,
   return  0;
 }
 
+void RGWServices_Def::shutdown()
+{
+  if (has_shutdown) {
+    return;
+  }
+
+  sysobj->shutdown();
+  sysobj_core->shutdown();
+  notify->shutdown();
+  if (sysobj_cache) {
+    sysobj_cache->shutdown();
+  }
+  quota->shutdown();
+  zone_utils->shutdown();
+  zone->shutdown();
+  rados->shutdown();
+
+  has_shutdown = true;
+
+}
+
 
 int RGWServices::init(CephContext *cct, bool have_cache)
 {
index c698c16ade740d990096626c2bcf50bf6b054d2a..abcb050d26e698397a1d92a6f8c5c9ad486ba398 100644 (file)
@@ -8,11 +8,11 @@
 
 #include "rgw/rgw_common.h"
 
-struct RGWServices_Shared;
+struct RGWServices_Def;
 
 class RGWServiceInstance
 {
-  friend struct RGWServices_Shared;
+  friend struct RGWServices_Def;
 
 protected:
   CephContext *cct;
@@ -54,6 +54,8 @@ class RGWSI_SysObj_Cache;
 
 struct RGWServices_Def
 {
+  bool has_shutdown{false};
+
   std::unique_ptr<RGWSI_Finisher> finisher;
   std::unique_ptr<RGWSI_Notify> notify;
   std::unique_ptr<RGWSI_RADOS> rados;
@@ -69,6 +71,7 @@ struct RGWServices_Def
   ~RGWServices_Def();
 
   int init(CephContext *cct, bool have_cache);
+  void shutdown();
 };
 
 
@@ -88,6 +91,9 @@ struct RGWServices
   RGWSI_SysObj_Core *core{nullptr};
 
   int init(CephContext *cct, bool have_cache);
+  void shutdown() {
+    _svc.shutdown();
+  }
 };