]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async: msgr2: fix mark_down vs accept race
authorRicardo Dias <rdias@suse.com>
Mon, 14 Jan 2019 11:47:15 +0000 (11:47 +0000)
committerRicardo Dias <rdias@suse.com>
Wed, 23 Jan 2019 13:59:27 +0000 (13:59 +0000)
Msgr2 version of PR #25823

Signed-off-by: Ricardo Dias <rdias@suse.com>
src/msg/async/ProtocolV2.cc

index 03b478b8ef3b7fa89a222d0a482fc6531ff7fa8d..0b6f7189617776cc33b5bdcb38885c6eb723d1f6 100644 (file)
@@ -2391,6 +2391,14 @@ CtPtr ProtocolV2::handle_cephx_auth(bufferlist &auth_payload) {
 
   connection->lock.lock();
 
+  if (state != ACCEPTING) {
+    ldout(cct, 1) << __func__
+                  << " state changed while accept, it must be mark_down"
+                  << dendl;
+    ceph_assert(state == CLOSED);
+    return _fault();
+  }
+
   session_security.reset(
       get_auth_session_handler(cct, auth_method, session_key,
                               connection_secret,
@@ -2456,6 +2464,14 @@ CtPtr ProtocolV2::handle_auth_request(char *payload, uint32_t length) {
        nullptr);
     connection->lock.lock();
 
+    if (state != ACCEPTING) {
+      ldout(cct, 1) << __func__
+                    << " state changed while accept, it must be mark_down"
+                    << dendl;
+      ceph_assert(state == CLOSED);
+      return _fault();
+    }
+
     if (!authorizer_valid) {
       ldout(cct, 0) << __func__ << " got bad authorizer, auth_reply_len="
                     << authorizer_reply.length() << dendl;