From: Kotresh HR Date: Wed, 14 Jan 2026 20:06:31 +0000 (+0530) Subject: tools/cephfs_mirror: Fix assert while opening handles X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=02f8639f1a5dd73377a500367a970851fc12d017;p=ceph-ci.git tools/cephfs_mirror: Fix assert while opening handles When the crawler or a datasync thread encountered an error, it's possible that the crawler gets notified by a datasync thread and bails out resulting in the unregister of the particular dir_root. The other datasync threads might still hold the same syncm object and tries to open the handles during which the following assert is hit. ceph_assert(it != m_registered.end()); The above assert is removed and the error is handled. Fixes: https://tracker.ceph.com/issues/73452 Signed-off-by: Kotresh HR --- diff --git a/src/tools/cephfs_mirror/PeerReplayer.cc b/src/tools/cephfs_mirror/PeerReplayer.cc index 15c8545fad9..1284cc01145 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/src/tools/cephfs_mirror/PeerReplayer.cc @@ -1267,7 +1267,13 @@ int PeerReplayer::pre_sync_check_and_open_handles( { std::scoped_lock locker(m_lock); auto it = m_registered.find(dir_root); - ceph_assert(it != m_registered.end()); + if (it == m_registered.end()) { + dout(5) << ": open handle came after unregister, this is from datasync threads" + << " on crawl or datasync error - returning EINVAL " << dendl; + ceph_close(m_local_mount, fh->c_fd); + ceph_close(fh->p_mnt, fh->p_fd); + return -EINVAL; + } fh->r_fd_dir_root = it->second.fd; }