From: Jos Collin Date: Mon, 25 Mar 2024 12:25:34 +0000 (+0530) Subject: cephfs_mirror: Fixes 'Bad file descriptor' showing during test_cephfs_mirror_cancel_m... X-Git-Tag: v18.2.5~240^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=229c16865ca9647a2099c617b5129798b685b0d5;p=ceph.git 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) --- 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();