]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: call at_exit() before stopping the engine 27177/head
authorKefu Chai <kchai@redhat.com>
Tue, 26 Mar 2019 03:59:01 +0000 (11:59 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 26 Mar 2019 03:59:02 +0000 (11:59 +0800)
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 <kchai@redhat.com>
src/crimson/osd/main.cc

index 1151f0f3a6da5010464a056924861182ecb5aa8b..41f0d50ca1642bab76c4392bc43fc84319c20cc1 100644 (file)
@@ -103,13 +103,6 @@ int main(int argc, char* argv[])
           reference_wrapper<ceph::net::Messenger>(client_msgr.local()),
           reference_wrapper<ceph::net::Messenger>(hb_front_msgr.local()),
           reference_wrapper<ceph::net::Messenger>(hb_back_msgr.local())).get();
-        if (config.count("mkfs")) {
-          osd.invoke_on(0, &OSD::mkfs,
-                        local_conf().get_val<uuid_d>("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<uuid_d>("fsid"))
+            .then([] { seastar::engine().exit(0); }).get();
+        } else {
+          osd.invoke_on(0, &OSD::start).get();
+        }
       });
     });
   } catch (...) {