]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient: resurrect "waiting for monmap|config" timeouts
authorIlya Dryomov <idryomov@gmail.com>
Thu, 1 Apr 2021 08:07:00 +0000 (10:07 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 12 Apr 2021 18:56:35 +0000 (20:56 +0200)
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 <idryomov@gmail.com>
(cherry picked from commit 6faa18e0a8e8efba6bd2978942eb9909b6568d5c)

src/mon/MonClient.cc

index 25c58b0b1cefcc92f9c11d723a0ba4a8761ea418..043c7fa8cf2c227f7131e62915fd5117bd65b800 100644 (file)
@@ -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;