Skip to content

Commit

Permalink
common: Sign in early SIGHUP signal
Browse files Browse the repository at this point in the history
Contains the following process:
ceph-mon ceph-mgr ceph-mds ceph-fuse radosgw.

Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
  • Loading branch information
renhwztetecs committed Feb 5, 2018
1 parent da3ba00 commit 1074e65
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/ceph_fuse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ int main(int argc, const char **argv, const char *envp[]) {

{
common_init_finish(g_ceph_context);

init_async_signal_handler();
register_async_signal_handler(SIGHUP, sighup_handler);

//cout << "child, mounting" << std::endl;
class RemountTest : public Thread {
Expand Down Expand Up @@ -240,9 +243,6 @@ int main(int argc, const char **argv, const char *envp[]) {
goto out_messenger_start_failed;
}

init_async_signal_handler();
register_async_signal_handler(SIGHUP, sighup_handler);

// start client
r = client->init();
if (r < 0) {
Expand Down
9 changes: 5 additions & 4 deletions src/ceph_mds.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ int main(int argc, const char **argv)

global_init_daemonize(g_ceph_context);
common_init_finish(g_ceph_context);


// set up signal handlers, now that we've daemonized/forked.
init_async_signal_handler();
register_async_signal_handler(SIGHUP, sighup_handler);

// get monmap
MonClient mc(g_ceph_context);
if (mc.build_initial_monmap() < 0)
Expand All @@ -196,9 +200,6 @@ int main(int argc, const char **argv)
goto shutdown;
}

// set up signal handlers, now that we've daemonized/forked.
init_async_signal_handler();
register_async_signal_handler(SIGHUP, sighup_handler);
register_async_signal_handler_oneshot(SIGINT, handle_mds_signal);
register_async_signal_handler_oneshot(SIGTERM, handle_mds_signal);

Expand Down
3 changes: 3 additions & 0 deletions src/ceph_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ int main(int argc, const char **argv)
global_init_daemonize(g_ceph_context);
global_init_chdir(g_ceph_context);
common_init_finish(g_ceph_context);

init_async_signal_handler();
register_async_signal_handler(SIGHUP, sighup_handler);

MgrStandby mgr(argc, argv);
int rc = mgr.init();
Expand Down
7 changes: 4 additions & 3 deletions src/ceph_mon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ int main(int argc, const char **argv)
pick_addresses(g_ceph_context, CEPH_PICK_ADDRESS_PUBLIC);

common_init_finish(g_ceph_context);

// set up signal handlers, now that we've daemonized/forked.
init_async_signal_handler();
register_async_signal_handler(SIGHUP, sighup_handler);

bufferlist monmapbl, osdmapbl;
std::string error;
Expand Down Expand Up @@ -789,9 +793,6 @@ int main(int argc, const char **argv)

mon->init();

// set up signal handlers, now that we've daemonized/forked.
init_async_signal_handler();
register_async_signal_handler(SIGHUP, sighup_handler);
register_async_signal_handler_oneshot(SIGINT, handle_mon_signal);
register_async_signal_handler_oneshot(SIGTERM, handle_mon_signal);

Expand Down
2 changes: 0 additions & 2 deletions src/mgr/MgrStandby.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,6 @@ int MgrStandby::main(vector<const char *> args)
{
// Enable signal handlers
signal_mgr = this;
init_async_signal_handler();
register_async_signal_handler(SIGHUP, sighup_handler);
register_async_signal_handler_oneshot(SIGINT, handle_mgr_signal);
register_async_signal_handler_oneshot(SIGTERM, handle_mgr_signal);

Expand Down
5 changes: 3 additions & 2 deletions src/rgw/rgw_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ int main(int argc, const char **argv)

common_init_finish(g_ceph_context);

init_async_signal_handler();
register_async_signal_handler(SIGHUP, sighup_handler);

int r = rgw_tools_init(g_ceph_context);
if (r < 0) {
derr << "ERROR: unable to initialize rgw tools" << dendl;
Expand Down Expand Up @@ -427,8 +430,6 @@ int main(int argc, const char **argv)
exit(1);
}

init_async_signal_handler();
register_async_signal_handler(SIGHUP, sighup_handler);
register_async_signal_handler(SIGTERM, handle_sigterm);
register_async_signal_handler(SIGINT, handle_sigterm);
register_async_signal_handler(SIGUSR1, handle_sigterm);
Expand Down

0 comments on commit 1074e65

Please sign in to comment.