From 229c16865ca9647a2099c617b5129798b685b0d5 Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Mon, 25 Mar 2024 17:55:34 +0530 Subject: [PATCH] cephfs_mirror: Fixes 'Bad file descriptor' showing during test_cephfs_mirror_cancel_mirroring_and_readd execution 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 (cherry picked from commit bd78bdca3d7d7659b7ec0f12b77a2002282fec13) --- src/tools/cephfs_mirror/PeerReplayer.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/cephfs_mirror/PeerReplayer.cc b/src/tools/cephfs_mirror/PeerReplayer.cc index 47a4fd0219f97..34c60d75b322c 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/src/tools/cephfs_mirror/PeerReplayer.cc @@ -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(); -- 2.39.5