diff options
author | Xuehan Xu <xxhdx1985126@163.com> | 2020-07-15 12:29:09 +0200 |
---|---|---|
committer | Xuehan Xu <xxhdx1985126@163.com> | 2020-07-16 11:30:48 +0200 |
commit | 1dc4c0cd692d219b56435322effad7d11e0807ac (patch) | |
tree | 70e544a849f8fe8374ea0b6868ff02529a06b546 /src/crimson/osd/osd.cc | |
parent | Merge pull request #33770 from majianpeng/osd-simple-logger (diff) | |
download | ceph-1dc4c0cd692d219b56435322effad7d11e0807ac.tar.xz ceph-1dc4c0cd692d219b56435322effad7d11e0807ac.zip |
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 <xxhdx1985126@163.com>
Diffstat (limited to '')
-rw-r--r-- | src/crimson/osd/osd.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index 694317f94fe..5986368a41d 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::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(); }); } |