]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commit
tools/cephfs_mirror: Fix lock order issue wip-khiremat-mulithread-mirror-66572-reviewed-2
authorKotresh HR <khiremat@redhat.com>
Sun, 15 Feb 2026 18:41:51 +0000 (00:11 +0530)
committerKotresh HR <khiremat@redhat.com>
Sat, 21 Feb 2026 20:04:09 +0000 (01:34 +0530)
commitbae6bc0b7ef6b8d344406f17f0087f38b7490eba
tree8dc8680b81ebe2e1ee4aa4275d11e793742de495
parentcf2159349fd6d5e6548479b8c1f8afcb9d6b10c9
tools/cephfs_mirror: Fix lock order issue

Lock order 1:
InstanceWatcher::m_lock ----> FSMirror::m_lock
Lock order 2:
FSMirror::m_lock -----> InstanceWatcher::m_lock

The Lock order 1 is where it's aborted and it happens
during blocklisting. The InstanceWatcher::handle_rewatch_complete()
acquires InstanceWatcher::m_lock and calls
m_elistener.set_blocklisted_ts() which tries to acquire
FSMirror::m_lock

The Lock order 2 exists in mirror peer status command.
The FSMirror::mirror_status(Formatter *f) takes FSMirro::m_lock
and calls is_blocklisted which takes InstanceWatcher::m_lock

Fix:
FSMirror::m_blocklisted_ts and FSMirror::m_failed_ts is converted
to std::<atomic> and also fixed the scope of m_lock in
InstanceWatcher::handle_rewatch_complete() and
MirrorWatcher::handle_rewatch_complete()

Look at the tracker for traceback and further details.

Fixes: https://tracker.ceph.com/issues/74953
Signed-off-by: Kotresh HR <khiremat@redhat.com>
src/tools/cephfs_mirror/FSMirror.h
src/tools/cephfs_mirror/InstanceWatcher.cc
src/tools/cephfs_mirror/MirrorWatcher.cc