From fc6ceeb8bf0cddaa32ee3a6b9b4978975833d094 Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Tue, 15 Jan 2019 16:42:15 +0000 Subject: [PATCH] msg/async: msgr2: send keepalive on connection race winner Msgr2 version of PR #25754 Signed-off-by: Ricardo Dias --- src/msg/async/ProtocolV2.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 4b203c10836..3492427210b 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -638,7 +638,8 @@ CtPtr ProtocolV2::_fault() { connection->fault(); reset_recv_state(); - if (connection->policy.standby && out_queue.empty() && state != WAIT) { + if (connection->policy.standby && out_queue.empty() && !keepalive && + state != WAIT) { ldout(cct, 10) << __func__ << " with nothing to send, going to standby" << dendl; state = STANDBY; @@ -2757,6 +2758,13 @@ CtPtr ProtocolV2::handle_existing_connection(AsyncConnectionRef existing) { << dendl; ceph_assert(connection->peer_addrs->msgr2_addr() > messenger->get_myaddrs().msgr2_addr()); + + existing->lock.unlock(); + // make sure we follow through with opening the existing + // connection (if it isn't yet open) since we know the peer + // has something to send to us. + existing->send_keepalive(); + existing->lock.lock(); WaitFrame wait; bufferlist &bl = wait.get_buffer(); return WRITE(bl, "wait", read_frame); -- 2.39.5