From: Kefu Chai Date: Tue, 26 Mar 2019 03:59:01 +0000 (+0800) Subject: crimson/osd: call at_exit() before stopping the engine X-Git-Tag: v15.0.0~86^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F27177%2Fhead;p=ceph.git crimson/osd: call at_exit() before stopping the engine if we mkfs and stop the engine, any calls using the engine should/will fail after `seastar::engine().exit(0)`. in the case of reactor::at_exit(), it has: assert(!_stopping); in this change, we register the at_exit() calls before scheduling the `engine().exit(0)` call. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/osd/main.cc b/src/crimson/osd/main.cc index 1151f0f3a6da..41f0d50ca164 100644 --- a/src/crimson/osd/main.cc +++ b/src/crimson/osd/main.cc @@ -103,13 +103,6 @@ int main(int argc, char* argv[]) reference_wrapper(client_msgr.local()), reference_wrapper(hb_front_msgr.local()), reference_wrapper(hb_back_msgr.local())).get(); - if (config.count("mkfs")) { - osd.invoke_on(0, &OSD::mkfs, - local_conf().get_val("fsid")) - .then([] { seastar::engine().exit(0); }).get(); - } else { - osd.invoke_on(0, &OSD::start).get(); - } seastar::engine().at_exit([&] { return osd.stop(); }); @@ -125,6 +118,14 @@ int main(int argc, char* argv[]) seastar::engine().at_exit([] { return sharded_conf().stop(); }); + + if (config.count("mkfs")) { + osd.invoke_on(0, &OSD::mkfs, + local_conf().get_val("fsid")) + .then([] { seastar::engine().exit(0); }).get(); + } else { + osd.invoke_on(0, &OSD::start).get(); + } }); }); } catch (...) {