]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/ProtocolV2: do not reenable pre_auth buffering on from reset_recv_state
authorSage Weil <sage@redhat.com>
Fri, 15 Mar 2019 03:50:29 +0000 (22:50 -0500)
committerSage Weil <sage@redhat.com>
Fri, 15 Mar 2019 11:08:51 +0000 (06:08 -0500)
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 <sage@redhat.com>
src/msg/async/ProtocolV2.cc

index 5078947533ca695912de4652501ad083385b4481..ed739d63eb43528067ef08dca94d16b5faaadfd0 100644 (file)
@@ -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;