]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/cephfs_mirror: Ignore duplicate directory acquire notifications 69467/head
authorKotresh HR <khiremat@redhat.com>
Sun, 14 Jun 2026 18:41:07 +0000 (00:11 +0530)
committerKotresh HR <khiremat@redhat.com>
Mon, 15 Jun 2026 10:45:37 +0000 (16:15 +0530)
Make PeerReplayer::add_directory() idempotent when the mgr re-sends
acquire for a directory already in the replayer list.

Fixes: https://tracker.ceph.com/issues/77398
Signed-off-by: Kotresh HR <khiremat@redhat.com>
src/tools/cephfs_mirror/PeerReplayer.cc

index 7ee7e06b757fdd1dfab8e2d87c3aea21429dcedf..93bc04ddaf81b8f2b020329b1e1e48ae846f4939 100644 (file)
@@ -357,10 +357,16 @@ void PeerReplayer::shutdown() {
 
 void PeerReplayer::add_directory(string_view dir_root) {
   dout(20) << ": dir_root=" << dir_root << dendl;
+  auto _dir_root = std::string(dir_root);
 
   std::scoped_lock locker(m_lock);
-  m_directories.emplace_back(dir_root);
-  m_snap_sync_stats.emplace(dir_root, SnapSyncStat());
+  if (std::find(m_directories.begin(), m_directories.end(), _dir_root) !=
+      m_directories.end()) {
+    dout(10) << ": dir_root=" << _dir_root << " already in replay list" << dendl;
+    return;
+  }
+  m_directories.emplace_back(_dir_root);
+  m_snap_sync_stats.emplace(_dir_root, SnapSyncStat());
   m_cond.notify_all();
 }