]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: take MirrorStatusUpdater lock by value in queue_update_task 70033/head
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Tue, 7 Jul 2026 02:03:59 +0000 (19:03 -0700)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 8 Jul 2026 11:34:52 +0000 (19:34 +0800)
queue_update_task() took the lock by rvalue reference, so its early
returns never released it. In handle_update_task() that left m_lock
held across the on_finish->complete() calls; during shutdown a
completion can re-enter try_remove_mirror_image_status() and re-lock
m_lock, deadlocking.

Take the unique_lock by value so it unlocks on every return path.

Fixes: https://tracker.ceph.com/issues/78047
Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
src/tools/rbd_mirror/MirrorStatusUpdater.cc
src/tools/rbd_mirror/MirrorStatusUpdater.h

index 497844e4989d38fc26fe897b670ad7acbd7b0c85..793ba658b45969d8e4c00243a002f2c45892f817 100644 (file)
@@ -277,7 +277,7 @@ void MirrorStatusUpdater<I>::handle_timer_task(int r) {
 
 template <typename I>
 void MirrorStatusUpdater<I>::queue_update_task(
-  std::unique_lock<ceph::mutex>&& locker) {
+  std::unique_lock<ceph::mutex> locker) {
   if (!m_initialized) {
     return;
   }
index 4cfbb699e5ffad9e3670489fd414e78ab64b943e..d9eaf06048d87ff536d51603428a9a87876207f7 100644 (file)
@@ -105,7 +105,7 @@ private:
   void schedule_timer_task();
   void handle_timer_task(int r);
 
-  void queue_update_task(std::unique_lock<ceph::mutex>&& locker);
+  void queue_update_task(std::unique_lock<ceph::mutex> locker);
   void update_task(int r);
   void handle_update_task(int r);