]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs_mirror: Fixes 'Bad file descriptor' showing during test_cephfs_mirror_cancel_m...
authorJos Collin <jcollin@redhat.com>
Mon, 25 Mar 2024 12:25:34 +0000 (17:55 +0530)
committerJos Collin <jcollin@redhat.com>
Tue, 8 Oct 2024 03:30:23 +0000 (09:00 +0530)
Avoid stale fh by calling pre_sync_check_and_open_handles inside the loop

Fixes: https://tracker.ceph.com/issues/65115
Signed-off-by: Jos Collin <jcollin@redhat.com>
(cherry picked from commit bd78bdca3d7d7659b7ec0f12b77a2002282fec13)

src/tools/cephfs_mirror/PeerReplayer.cc

index 47a4fd0219f9703fa431df0a3f406f85fe8f4476..34c60d75b322c6e73f9a99ac3547ffc84ddef71f 100644 (file)
@@ -1266,6 +1266,12 @@ int PeerReplayer::do_synchronize(const std::string &dir_root, const Snapshot &cu
       break;
     }
 
+    r = pre_sync_check_and_open_handles(dir_root, current, boost::none, &fh);
+    if (r < 0) {
+      dout(5) << ": cannot proceed with sync: " << cpp_strerror(r) << dendl;
+      return r;
+    }
+
     dout(20) << ": " << sync_stack.size() << " entries in stack" << dendl;
     std::string e_name;
     auto &entry = sync_stack.top();