From 372b7aed8a4a1a39fd295835b023f93f8b2756b2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 7 Feb 2019 12:28:20 -0600 Subject: [PATCH] mon/MonClient: fix keepalive with v2 auth The old trick of queuing a keepalive sequenced before auth does not work when auth happens earlier in the process. Work around it. Signed-off-by: Sage Weil --- src/mon/MonClient.cc | 3 +++ src/mon/MonClient.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 8b8faece8cf3b..f26ef47ea65a1 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -1475,6 +1475,8 @@ bool MonConnection::have_session() const void MonConnection::start(epoch_t epoch, const EntityName& entity_name) { + auth_start = ceph_clock_now(); + if (con->get_peer_addr().is_msgr2()) { ldout(cct, 10) << __func__ << " opening mon connection" << dendl; state = State::AUTHENTICATING; @@ -1594,6 +1596,7 @@ int MonConnection::handle_auth_done( if (auth_err >= 0) { state = State::HAVE_SESSION; } + con->set_last_keepalive_ack(auth_start); return auth_err; } diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index 5503d46943d06..3b8faf58b5960 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -121,6 +121,7 @@ private: State state = State::NONE; ConnectionRef con; int auth_method = -1; + utime_t auth_start; std::unique_ptr auth; uint64_t global_id; -- 2.39.5