From 8449b4c191fc7dbcd0d62267c9a9c419f50ccf6b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 14 Mar 2019 22:50:29 -0500 Subject: [PATCH] msg/async/ProtocolV2: do not reenable pre_auth buffering on from reset_recv_state This is specifically bad because we call reset_recv_state from reuse_connection, which turns buffering back on on an already-authenticated session. Instead, reenable it only when we set the state to START_CONNECT. (On the accepting side, it is a fresh connection, so it starts out true.) Also, we want to *disable* it on the connection we are reusing, which might be in a pre-auth state, while we are in a post-auth state. Fixes: http://tracker.ceph.com/issues/38746 Signed-off-by: Sage Weil --- src/msg/async/ProtocolV2.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 5078947533ca6..ed739d63eb435 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -102,6 +102,7 @@ ProtocolV2::~ProtocolV2() { void ProtocolV2::connect() { ldout(cct, 1) << __func__ << dendl; state = START_CONNECT; + pre_auth.enabled = true; } void ProtocolV2::accept() { @@ -224,7 +225,6 @@ void ProtocolV2::reset_recv_state() { auth_meta.reset(new AuthConnectionMeta); session_stream_handlers.tx.reset(nullptr); session_stream_handlers.rx.reset(nullptr); - pre_auth.enabled = true; pre_auth.txbuf.clear(); pre_auth.rxbuf.clear(); } @@ -346,6 +346,7 @@ CtPtr ProtocolV2::_fault() { connect_seq++; global_seq = messenger->get_global_seq(); state = START_CONNECT; + pre_auth.enabled = true; connection->state = AsyncConnection::STATE_CONNECTING; } backoff = utime_t(); @@ -367,6 +368,7 @@ CtPtr ProtocolV2::_fault() { global_seq = messenger->get_global_seq(); state = START_CONNECT; + pre_auth.enabled = true; connection->state = AsyncConnection::STATE_CONNECTING; ldout(cct, 1) << __func__ << " waiting " << backoff << dendl; // woke up again; @@ -2626,6 +2628,7 @@ CtPtr ProtocolV2::reuse_connection(AsyncConnectionRef existing, ceph_assert(!connection->delay_state); } exproto->reset_recv_state(); + exproto->pre_auth.enabled = false; if (!reconnecting) { exproto->client_cookie = client_cookie; -- 2.39.5