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: v20.0.0~902^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bd78bdca3d7d7659b7ec0f12b77a2002282fec13;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 --- diff --git a/src/tools/cephfs_mirror/PeerReplayer.cc b/src/tools/cephfs_mirror/PeerReplayer.cc index ce35b72ed0e9b..ffb2bfbd94049 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/src/tools/cephfs_mirror/PeerReplayer.cc @@ -1281,6 +1281,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();