From: Kotresh HR Date: Tue, 7 Jul 2026 07:07:21 +0000 (+0530) Subject: tools/cephfs-mirror: Fix truncated sync from stale crawl-time file size X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f2ee574aab0c46e34c7880c155a60a5b16f519d0;p=ceph.git tools/cephfs-mirror: Fix truncated sync from stale crawl-time file size Drop AT_STATX_DONT_SYNC from stat calls in the crawler thread that populate SyncEntry objects. The flag could leave a stale file size from readdir, causing datasync to truncate files to the wrong length. For RemoteSync, use inode attrs from ceph_readdirplus_r instead of a redundant ceph_statxat. Fixes: https://tracker.ceph.com/issues/77393 Signed-off-by: Kotresh HR --- diff --git a/src/tools/cephfs_mirror/PeerReplayer.cc b/src/tools/cephfs_mirror/PeerReplayer.cc index 8cb8dbdd183..8c8fc3259fd 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/src/tools/cephfs_mirror/PeerReplayer.cc @@ -2468,7 +2468,7 @@ int PeerReplayer::SnapDiffSync::init_sync() { int r = ceph_fstatx(m_local, m_fh->c_fd, &tstx, CEPH_STATX_MODE | CEPH_STATX_UID | CEPH_STATX_GID | CEPH_STATX_SIZE | CEPH_STATX_ATIME | CEPH_STATX_MTIME, - AT_STATX_DONT_SYNC | AT_SYMLINK_NOFOLLOW); + AT_SYMLINK_NOFOLLOW); if (r < 0) { derr << ": failed to stat snap=" << m_current.first << ": " << cpp_strerror(r) << dendl; @@ -2635,7 +2635,7 @@ int PeerReplayer::SnapDiffSync::get_entry(std::string *epath, struct ceph_statx r = ceph_statxat(m_local, m_fh->c_fd, _epath.c_str(), &estx, CEPH_STATX_MODE | CEPH_STATX_UID | CEPH_STATX_GID | CEPH_STATX_SIZE | CEPH_STATX_ATIME | CEPH_STATX_MTIME, - AT_STATX_DONT_SYNC | AT_SYMLINK_NOFOLLOW); + AT_SYMLINK_NOFOLLOW); if (r < 0) { derr << ": failed to stat epath=" << epath << ", r=" << r << dendl; return r; @@ -2811,7 +2811,7 @@ int PeerReplayer::RemoteSync::init_sync() { int r = ceph_fstatx(m_local, m_fh->c_fd, &tstx, CEPH_STATX_MODE | CEPH_STATX_UID | CEPH_STATX_GID | CEPH_STATX_SIZE | CEPH_STATX_ATIME | CEPH_STATX_MTIME, - AT_STATX_DONT_SYNC | AT_SYMLINK_NOFOLLOW); + AT_SYMLINK_NOFOLLOW); if (r < 0) { derr << ": failed to stat snap=" << m_current.first << ": " << cpp_strerror(r) << dendl; @@ -2878,7 +2878,7 @@ int PeerReplayer::RemoteSync::get_entry(std::string *epath, struct ceph_statx *s r = ceph_statxat(m_local, m_fh->c_fd, _epath.c_str(), &cstx, CEPH_STATX_MODE | CEPH_STATX_UID | CEPH_STATX_GID | CEPH_STATX_SIZE | CEPH_STATX_ATIME | CEPH_STATX_MTIME, - AT_STATX_DONT_SYNC | AT_SYMLINK_NOFOLLOW); + AT_SYMLINK_NOFOLLOW); if (r < 0) { derr << ": failed to stat epath=" << _epath << ": " << cpp_strerror(r) << dendl;