]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: fix shutdown err with resources uncleaned 19279/head
authorTao Chen <chentao@umcloud.com>
Fri, 1 Dec 2017 08:42:44 +0000 (16:42 +0800)
committertaoCH <sebastien.chen92@gmail.com>
Fri, 1 Dec 2017 09:45:41 +0000 (17:45 +0800)
Fixed: http://tracker.ceph.com/issues/22296

Signed-off-by: Tao Chen <chentao@umcloud.com>
src/rgw/librgw.cc

index f114a589bbf769355161a4ae855094bd8ecc1778..4d7e32aaf4bbde25763e6300dc3593302e90868e 100644 (file)
@@ -24,6 +24,7 @@
 #include "include/str_list.h"
 #include "include/stringify.h"
 #include "global/global_init.h"
+#include "global/signal_handler.h"
 #include "common/config.h"
 #include "common/errno.h"
 #include "common/Timer.h"
 
 bool global_stop = false;
 
+static void handle_sigterm(int signum)
+{
+  dout(20) << __func__ << " SIGUSR1 ignored" << dendl;
+}
+
 namespace rgw {
 
   using std::string;
@@ -544,6 +550,9 @@ namespace rgw {
     fec = new RGWFrontendConfig("rgwlib");
     fe = new RGWLibFrontend(env, fec);
 
+    init_async_signal_handler();
+    register_async_signal_handler(SIGUSR1, handle_sigterm);
+
     map<string, string> service_map_meta;
     service_map_meta["pid"] = stringify(getpid());
     service_map_meta["frontend_type#" + fe_count] = "rgw-nfs";
@@ -578,6 +587,9 @@ namespace rgw {
     delete fec;
     delete ldh;
 
+    unregister_async_signal_handler(SIGUSR1, handle_sigterm);
+    shutdown_async_signal_handler();
+
     rgw_log_usage_finalize();
 
     delete olog;