]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: fix osd shutdown problem 36128/head
authorXuehan Xu <xxhdx1985126@163.com>
Wed, 15 Jul 2020 10:29:09 +0000 (18:29 +0800)
committerXuehan Xu <xxhdx1985126@163.com>
Thu, 16 Jul 2020 09:30:48 +0000 (17:30 +0800)
when doing full-system shutdown, monitors may go down before OSDs in which case
the osd shutdown hangs waiting for monc to successfully send the markmedown msg
to monitors

Fixes: https://tracker.ceph.com/issues/46564
Signed-off-by: Xuehan Xu <xxhdx1985126@163.com>
src/crimson/osd/osd.cc

index 694317f94fe84d2f47c405c0459c3417236f231a..5986368a41dcac0743a87f772f841317b0497cf9 100644 (file)
@@ -1265,21 +1265,24 @@ seastar::future<> OSD::prepare_to_stop()
 {
   if (osdmap && osdmap->is_up(whoami)) {
     state.set_prestop();
-    return monc->send_message(
+    const auto timeout =
+      std::chrono::duration_cast<std::chrono::milliseconds>(
+       std::chrono::duration<double>(
+         local_conf().get_val<double>("osd_mon_shutdown_timeout")));
+
+    return seastar::with_timeout(
+      seastar::timer<>::clock::now() + timeout,
+      monc->send_message(
          make_message<MOSDMarkMeDown>(
            monc->get_fsid(),
            whoami,
            osdmap->get_addrs(whoami),
            osdmap->get_epoch(),
            true)).then([this] {
-      const auto timeout =
-       std::chrono::duration_cast<std::chrono::milliseconds>(
-         std::chrono::duration<double>(
-           local_conf().get_val<double>("osd_mon_shutdown_timeout")));
-      return seastar::with_timeout(
-      seastar::timer<>::clock::now() + timeout,
-      stop_acked.get_future());
-    }).handle_exception_type([this](seastar::timed_out_error&) {
+       return stop_acked.get_future();
+      })
+    ).handle_exception_type(
+      [](seastar::timed_out_error&) {
       return seastar::now();
     });
   }