From: Radoslaw Zarzynski Date: Wed, 18 Dec 2019 14:30:31 +0000 (+0100) Subject: msg/async: reset the V1's session_security in proper EventCenter. X-Git-Tag: v14.2.10~200^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c2af6c4af93d9136f34ae5d598518c7d443d1340;p=ceph.git 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). --- diff --git a/src/msg/async/ProtocolV1.cc b/src/msg/async/ProtocolV1.cc index 5840eaf4994..42eb2d6eaed 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();