From 6dbc5488185ba5289fb59fb4663e2e01b3e5f247 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Thu, 1 Apr 2021 10:07:00 +0200 Subject: [PATCH] mon/MonClient: resurrect "waiting for monmap|config" timeouts This fixes a regression introduced in commit 85157d5aae3d ("mon: s/Mutex/ceph::mutex/"). Waiting for monmap and config indefinitely is not just bad UX, it actually masks other more serious bugs. Signed-off-by: Ilya Dryomov (cherry picked from commit 6faa18e0a8e8efba6bd2978942eb9909b6568d5c) --- src/mon/MonClient.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 25c58b0b1cefc..043c7fa8cf2c2 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -162,8 +162,11 @@ int MonClient::get_monmap_and_config() } while ((!got_config || monmap.get_epoch() == 0) && r == 0) { ldout(cct,20) << __func__ << " waiting for monmap|config" << dendl; - map_cond.wait_for(l, ceph::make_timespan( - cct->_conf->mon_client_hunt_interval)); + auto status = map_cond.wait_for(l, ceph::make_timespan( + cct->_conf->mon_client_hunt_interval)); + if (status == std::cv_status::timeout) { + r = -ETIMEDOUT; + } } if (got_config) { ldout(cct,10) << __func__ << " success" << dendl; -- 2.39.5