From: Sage Weil Date: Mon, 5 Mar 2018 18:59:32 +0000 (-0600) Subject: mon/MonClient: fix auth timeout vs error race X-Git-Tag: wip-pdonnell-testing-20180317.202121~121^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=148db39cf9216cbbcca7faea3efed1f2200e61d4;p=ceph-ci.git mon/MonClient: fix auth timeout vs error race It's possible that we successfully set active_con *and* time out the cond WaitUntil. Only set the error if we don't have a connection; if we set it *and* time out then let's call it success. Signed-off-by: Sage Weil --- diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index b21eb3f9a82..b246c064006 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -494,10 +494,11 @@ int MonClient::authenticate(double timeout) until += timeout; if (timeout > 0.0) ldout(cct, 10) << "authenticate will time out at " << until << dendl; + authenticate_err = 0; while (!active_con && !authenticate_err) { if (timeout > 0.0) { int r = auth_cond.WaitUntil(monc_lock, until); - if (r == ETIMEDOUT) { + if (r == ETIMEDOUT && !active_con) { ldout(cct, 0) << "authenticate timed out after " << timeout << dendl; authenticate_err = -r; }