]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
msg: fix deadlock when handling existing but closed v2 connection 46732/head
authorRadosław Zarzyński <rzarzyns@redhat.com>
Fri, 17 Jun 2022 12:17:25 +0000 (14:17 +0200)
committerRadosław Zarzyński <rzarzyns@redhat.com>
Fri, 17 Jun 2022 12:27:50 +0000 (14:27 +0200)
commita6fcb1ccbc44e60416eb5f4e2c7291afe3a9d44d
tree266d429a86d4177390592d8e93b86eeb6222fcc3
parentb76b6ea16899861d6c266797b3c11d9f68f924d7
msg: fix deadlock when handling existing but closed v2 connection

The deadlock is illustrated best by the following snippet
provided by jianwei zhang who also made the problem analysis
(many thanks!).

```
thread-35
AsyncMessenger::shutdown_connections         hold             AsyncMessenger::lock            std::lock_guard l{lock}
AsyncConnection::stop                         wait                AsyncConnection::lock            lock.lock()

thread-3
ProtocolV2::handle_existing_connection        hold                AsyncConnection::lock            std::lock_guard<std::mutex> l(existing->lock)
AsyncMessenger::accept_conn                wait                AsyncMessenger::lock            std::lock_guard l{lock}
```

Fixes: https://tracker.ceph.com/issues/55355
Signed-off-by: Radosław Zarzyński <rzarzyns@redhat.com>
src/msg/async/ProtocolV2.cc