]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/cephfs_mirror: Mark crawl finished
authorKotresh HR <khiremat@redhat.com>
Tue, 9 Dec 2025 10:05:08 +0000 (15:35 +0530)
committerKotresh HR <khiremat@redhat.com>
Sat, 21 Feb 2026 20:12:39 +0000 (01:42 +0530)
After entry operations are synced and stack is empty,
mark the crawl as finished so the data sync threads'
wait logic works correctly and doesn't indefinitely wait.

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

index b7b09c9c04c0ecef211ea9db5a33f6c02450dd4d..0ac65efd456d9ee3205a1f202b6412b902ca3a24 100644 (file)
@@ -1641,7 +1641,7 @@ int PeerReplayer::SnapDiffSync::get_changed_blocks(const std::string &epath,
   return r;
 }
 
-void PeerReplayer::SnapDiffSync::finish_sync() {
+void PeerReplayer::SnapDiffSync::finish_crawl() {
   dout(20) << dendl;
 
   while (!m_sync_stack.empty()) {
@@ -1655,6 +1655,9 @@ void PeerReplayer::SnapDiffSync::finish_sync() {
 
     m_sync_stack.pop();
   }
+
+  // Crawl and entry operations are done syncing here. So mark crawl finished here
+  mark_crawl_finished();
 }
 
 PeerReplayer::RemoteSync::RemoteSync(MountRef local, MountRef remote, FHandles *fh,
@@ -1787,7 +1790,7 @@ int PeerReplayer::RemoteSync::get_entry(std::string *epath, struct ceph_statx *s
   return 0;
 }
 
-void PeerReplayer::RemoteSync::finish_sync() {
+void PeerReplayer::RemoteSync::finish_crawl() {
   dout(20) << dendl;
 
   while (!m_sync_stack.empty()) {
@@ -1801,6 +1804,9 @@ void PeerReplayer::RemoteSync::finish_sync() {
 
     m_sync_stack.pop();
   }
+
+  // Crawl and entry operations are done syncing here. So mark stack finished here
+  mark_crawl_finished();
 }
 
 int PeerReplayer::do_synchronize(const std::string &dir_root, const Snapshot &current,
@@ -1903,7 +1909,7 @@ int PeerReplayer::do_synchronize(const std::string &dir_root, const Snapshot &cu
     }
   }
 
-  syncm->finish_sync();
+  syncm->finish_crawl();
 
   dout(20) << " cur:" << fh.c_fd
            << " prev:" << fh.p_fd
index e7c9d969b26e3e7238d49c69f22a1473952f3c4f..f75a508753fa6fdf697169bbb74de2374345335e 100644 (file)
@@ -193,7 +193,7 @@ private:
                                    const struct ceph_statx &stx, bool sync_check,
                                    const std::function<int (uint64_t, struct cblock *)> &callback);
 
-    virtual void finish_sync() = 0;
+    virtual void finish_crawl() = 0;
 
     void push_dataq_entry(PeerReplayer::SyncEntry e);
     bool pop_dataq_entry(PeerReplayer::SyncEntry &out);
@@ -227,7 +227,7 @@ private:
                   const std::function<int (const std::string&)> &dirsync_func,
                   const std::function<int (const std::string&)> &purge_func);
 
-    void finish_sync();
+    void finish_crawl();
   };
 
   class SnapDiffSync : public SyncMechanism {
@@ -247,7 +247,7 @@ private:
                            const struct ceph_statx &stx, bool sync_check,
                            const std::function<int (uint64_t, struct cblock *)> &callback);
 
-    void finish_sync();
+    void finish_crawl();
 
   private:
     int init_directory(const std::string &epath,