From: Xuehan Xu Date: Wed, 15 Jul 2020 10:29:09 +0000 (+0800) Subject: crimson/osd: fix osd shutdown problem X-Git-Tag: v16.1.0~1703^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1dc4c0cd692d219b56435322effad7d11e0807ac;p=ceph.git crimson/osd: fix osd shutdown problem 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 --- diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index 694317f94fe8..5986368a41dc 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -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::duration( + local_conf().get_val("osd_mon_shutdown_timeout"))); + + return seastar::with_timeout( + seastar::timer<>::clock::now() + timeout, + monc->send_message( make_message( monc->get_fsid(), whoami, osdmap->get_addrs(whoami), osdmap->get_epoch(), true)).then([this] { - const auto timeout = - std::chrono::duration_cast( - std::chrono::duration( - local_conf().get_val("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(); }); }