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=80f46b72808cbc65dbcd14f87750cf8a86216690;p=ceph.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 fd426d2a24a..5b8a56479c0 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 392cdcf1af4..f5d5db22829 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; @@ -470,7 +470,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;