]> 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-5-fix-purge-snap
authorKotresh HR <khiremat@redhat.com>
Sun, 15 Feb 2026 18:41:51 +0000 (00:11 +0530)
committerKotresh HR <khiremat@redhat.com>
Sun, 22 Feb 2026 19:00:49 +0000 (00:30 +0530)
commit4efa9e5f073d7632f3eb8e28f202b3e2d0127e28
treebbf902edc998531d5773870f7dcb6c06887b7cca
parent1e4829589dbed8686c1dacac2ea7a555b8f39347
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