]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tools/cephfs_mirror: Fix assert while opening handles
authorKotresh HR <khiremat@redhat.com>
Wed, 14 Jan 2026 20:06:31 +0000 (01:36 +0530)
committerKotresh HR <khiremat@redhat.com>
Tue, 17 Feb 2026 20:10:51 +0000 (01:40 +0530)
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 <khiremat@redhat.com>
src/tools/cephfs_mirror/PeerReplayer.cc

index 15c8545fad9a86fb88b935a7fe3a8491b62e38af..1284cc011454fb99a070559fcd27f7d85024f757 100644 (file)
@@ -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;
   }