From c2af6c4af93d9136f34ae5d598518c7d443d1340 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Wed, 18 Dec 2019 15:30:31 +0100 Subject: [PATCH] msg/async: reset the V1's session_security in proper EventCenter. Fixes: https://tracker.ceph.com/issues/43070 Signed-off-by: Radoslaw Zarzynski (cherry picked from commit 6548dbcf30d5f880ad789560235688eef0cf2b56) Conflicts: src/msg/async/ProtocolV1.cc (removing the dependency on c58c5754dfd26eef359cad8b29e825120af59c64). --- src/msg/async/ProtocolV1.cc | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/msg/async/ProtocolV1.cc b/src/msg/async/ProtocolV1.cc index 5840eaf499485..42eb2d6eaed28 100644 --- a/src/msg/async/ProtocolV1.cc +++ b/src/msg/async/ProtocolV1.cc @@ -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 l(connection->lock); + std::lock_guard 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(); -- 2.39.5