From: Kotresh HR Date: Sun, 15 Feb 2026 03:09:54 +0000 (+0530) Subject: tools/cephfs_mirror: Make PeerReplayer::m_stopping atomic X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6ce5437e67c9ed1af3ea1f92358816dc3aa81c06;p=ceph-ci.git tools/cephfs_mirror: Make PeerReplayer::m_stopping atomic Make PeerReplayer::m_stopping as std:: and make it independant of m_lock. This helps 'm_stopping' to be used as predicate in any conditional wait which doesn't use m_lock. Fixes: https://tracker.ceph.com/issues/73452 Signed-off-by: Kotresh HR --- diff --git a/src/tools/cephfs_mirror/PeerReplayer.cc b/src/tools/cephfs_mirror/PeerReplayer.cc index 1284cc01145..69c3f1f9e6c 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/src/tools/cephfs_mirror/PeerReplayer.cc @@ -315,11 +315,14 @@ int PeerReplayer::init() { void PeerReplayer::shutdown() { dout(20) << dendl; + bool expected = false; + if (!m_stopping.compare_exchange_strong(expected, true)) { + dout(1) << ": shutdown is already in progress - return"<< dendl; + return; + } { - std::scoped_lock locker(m_lock); - ceph_assert(!m_stopping); - m_stopping = true; - m_cond.notify_all(); + std::scoped_lock lock(m_lock); + m_cond.notify_all(); //wake up shutdown wait } for (auto &replayer : m_replayers) { diff --git a/src/tools/cephfs_mirror/PeerReplayer.h b/src/tools/cephfs_mirror/PeerReplayer.h index 98c94a4838e..e294e5bd076 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.h +++ b/src/tools/cephfs_mirror/PeerReplayer.h @@ -76,7 +76,7 @@ private: }; bool is_stopping() { - return m_stopping; + return m_stopping.load(std::memory_order_acquire); } struct Replayer; @@ -472,7 +472,7 @@ private: ceph::condition_variable m_cond; RadosRef m_remote_cluster; MountRef m_remote_mount; - bool m_stopping = false; + std::atomic m_stopping{false}; SnapshotReplayers m_replayers; SnapshotDataReplayers m_data_replayers;