]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commit
rbd-mirror: fix potential deadlock in finish_shut_down()
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Thu, 6 Nov 2025 10:29:42 +0000 (15:59 +0530)
committerIlya Dryomov <idryomov@redhat.com>
Sat, 22 Nov 2025 16:46:48 +0000 (17:46 +0100)
commit42846fdb1085a1a5bc0789bf477237fbbb86c9fd
tree2cfd9bacbeef40343e8c0cfc04c9e97e2a0dd453
parentb80f3926411f0de9d73d118d013319c72ef8cd14
rbd-mirror: fix potential deadlock in finish_shut_down()

Problem:
A race condition could lead to a deadlock in finish_shut_down(). The issue
occurs when the routine attempts to acquire m_lock while it is already held
by one of the Replayer callbacks, such as validate_local_group_snapshots() or
create_group_snapshot().

Solution:
Refactored finish_shut_down() to run asynchronously by splitting it into two
routines, wait_for_in_flight_ops() and handle_wait_for_in_flight_ops(). The
handle_wait_for_in_flight_ops() function acquires the lock, but now executes in
a separate thread, avoiding lock contention and eliminating the deadlock risk.

Credits to Ilya Dryomov <idryomov@gmail.com>

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Resolves: rhbz#2411963
src/tools/rbd_mirror/group_replayer/Replayer.cc
src/tools/rbd_mirror/group_replayer/Replayer.h