]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: call engine().exit(0) after mkfs
authorKefu Chai <kchai@redhat.com>
Fri, 15 Mar 2019 04:36:09 +0000 (12:36 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 20 Mar 2019 03:49:45 +0000 (11:49 +0800)
* crimson/osd/main.cc:
  if crimson-osd is launched as a daemon, we can always stop it using
  SIGINT, and seastar::reactor does stop itself when handling this signal.

  but if we start crimson-osd as an ordinary command line tool, we should
  stop it explicitly after it is done with its job. so call
  seastar::engine().exit().
* crimson/osd/osd.cc:
  do not stop unitialized services in OSD::stop(). OSD is initialized as
  a sharded service in main.cc, so we have to stop it before stopping
  engine. if OSD is used for mkfs, the internal services like heartbeat,
  monc, mgrc are not initialized at all, so we should not stop them in
  this case. and in theory, user could stop crimson-osd when it boots,
  so we need to check the pointers for null before dereferencing them.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/main.cc

index 04a0c97dfc8f30515b22d5ccf7801d9e2ead78de..d029280baa1b599da68cef5b058fe42a20fac28a 100644 (file)
@@ -68,7 +68,8 @@ int main(int argc, char* argv[])
       }).then([&osd, mkfs = config.count("mkfs")] {
         if (mkfs) {
           return osd.invoke_on(0, &OSD::mkfs,
-                               local_conf().get_val<uuid_d>("fsid"));
+                               local_conf().get_val<uuid_d>("fsid"))
+            .then([] { seastar::engine().exit(0); });
         } else {
           return osd.invoke_on(0, &OSD::start);
         }