Skip to content

Commit c605140

Browse files
committed
rbd-mirror: fix possible recursive lock of ImageReplayer::m_lock
If periodic status update (LambdaContext which is queued from handle_update_mirror_image_replay_status()) races with shutdown and ends up being the last in-flight operation that shutdown was pending on, we attempt to recursively acquire m_lock in shut_down() because m_in_flight_op_tracker.finish_op() is called with m_lock (and also m_threads->timer_lock) held. These locks are needed only for the call to schedule_update_mirror_image_replay_status() and should be unlocked immediately. Fixes: https://tracker.ceph.com/issues/69978 Co-authored-by: Ilya Dryomov <[email protected]> Signed-off-by: N Balachandran <[email protected]>
1 parent 92ef6ae commit c605140

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/tools/rbd_mirror/ImageReplayer.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,10 +719,12 @@ void ImageReplayer<I>::handle_update_mirror_image_replay_status(int r) {
719719
auto ctx = new LambdaContext([this](int) {
720720
update_mirror_image_status(false, boost::none);
721721

722-
std::unique_lock locker{m_lock};
723-
std::unique_lock timer_locker{m_threads->timer_lock};
722+
{
723+
std::unique_lock locker{m_lock};
724+
std::unique_lock timer_locker{m_threads->timer_lock};
724725

725-
schedule_update_mirror_image_replay_status();
726+
schedule_update_mirror_image_replay_status();
727+
}
726728
m_in_flight_op_tracker.finish_op();
727729
});
728730

0 commit comments

Comments
 (0)