]> 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-1
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 16:34:18 +0000 (22:04 +0530)
commitbb877a712a270719b36d781e07c47a96dbebe807
treec3b6ae041d7218ce57f36eb59d4ca389a8c0857b
parentde45c4d215435202273128ec81bf62a044337e08
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