mirror of
https://github.com/ceph/ceph
synced 2024-12-17 17:05:42 +00:00
mds: install signal handlers after init
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
868b48634b
commit
318f3df718
@ -274,12 +274,6 @@ int main(int argc, const char **argv)
|
||||
|
||||
messenger->start();
|
||||
|
||||
// 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);
|
||||
|
||||
// start mds
|
||||
mds = new MDS(g_conf->name.get_id().c_str(), messenger, &mc);
|
||||
|
||||
@ -291,16 +285,23 @@ int main(int argc, const char **argv)
|
||||
r = mds->init(shadow);
|
||||
else
|
||||
r = mds->init();
|
||||
if (r < 0)
|
||||
goto shutdown;
|
||||
|
||||
if (r >= 0) {
|
||||
messenger->wait();
|
||||
}
|
||||
// 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);
|
||||
|
||||
messenger->wait();
|
||||
|
||||
unregister_async_signal_handler(SIGHUP, sighup_handler);
|
||||
unregister_async_signal_handler(SIGINT, handle_mds_signal);
|
||||
unregister_async_signal_handler(SIGTERM, handle_mds_signal);
|
||||
shutdown_async_signal_handler();
|
||||
|
||||
shutdown:
|
||||
// yuck: grab the mds lock, so we can be sure that whoever in *mds
|
||||
// called shutdown finishes what they were doing.
|
||||
mds->mds_lock.Lock();
|
||||
|
Loading…
Reference in New Issue
Block a user