From d22a1b0e00f93d3c2b25f4e7a730f4951c14a01e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 26 Mar 2019 11:59:01 +0800 Subject: [PATCH] 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 --- src/crimson/osd/main.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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 (...) { -- 2.47.3