From 0fa2be059e649684a4fe15a456d564acde8e7831 Mon Sep 17 00:00:00 2001 From: Tao Chen Date: Fri, 1 Dec 2017 16:42:44 +0800 Subject: [PATCH] librgw: fix shutdown err with resources uncleaned Fixed: http://tracker.ceph.com/issues/22296 Signed-off-by: Tao Chen --- src/rgw/librgw.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc index f114a589bbf7..4d7e32aaf4bb 100644 --- a/src/rgw/librgw.cc +++ b/src/rgw/librgw.cc @@ -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" @@ -61,6 +62,11 @@ 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 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; -- 2.47.3