]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: reset the V1's session_security in proper EventCenter.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 18 Dec 2019 14:30:31 +0000 (15:30 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 9 Mar 2020 11:38:34 +0000 (12:38 +0100)
Fixes: https://tracker.ceph.com/issues/43070
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
(cherry picked from commit 6548dbcf30d5f880ad789560235688eef0cf2b56)

Conflicts:
        src/msg/async/ProtocolV1.cc (removing the dependency
          on c58c5754dfd26eef359cad8b29e825120af59c64).

src/msg/async/ProtocolV1.cc

index 5840eaf499485a20e9f8983c1fffb06df380be79..42eb2d6eaed28591d9ac1d19a7651b34e4447444 100644 (file)
@@ -1241,13 +1241,27 @@ void ProtocolV1::discard_out_queue() {
 }
 
 void ProtocolV1::reset_recv_state() {
-  // clean up state internal variables and states
-  if (state == CONNECTING_SEND_CONNECT_MSG) {
-    if (authorizer) {
-      delete authorizer;
+  ldout(cct, 5) << __func__ << dendl;
+
+  // execute in the same thread that uses the `session_security`.
+  // We need to do the warp because holding `write_lock` is not
+  // enough as `write_event()` releases it just before calling
+  // `write_message()`. `submit_to()` here is NOT blocking.
+  connection->center->submit_to(connection->center->get_id(), [this] {
+    ldout(cct, 5) << "reset_recv_state reseting security handlers" << dendl;
+
+    // Possibly unnecessary. See the comment in `deactivate_existing`.
+    std::lock_guard<std::mutex> l(connection->lock);
+    std::lock_guard<std::mutex> wl(connection->write_lock);
+
+    // clean up state internal variables and states
+    if (state == CONNECTING_SEND_CONNECT_MSG) {
+      if (authorizer) {
+        delete authorizer;
+      }
+      authorizer = nullptr;
     }
-    authorizer = nullptr;
-  }
+  }, /* nowait = */true);
 
   // clean read and write callbacks
   connection->pendingReadLen.reset();