]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/cephfs-mirror: Fix truncated sync from stale crawl-time file size 69466/head
authorKotresh HR <khiremat@redhat.com>
Tue, 7 Jul 2026 07:07:21 +0000 (12:37 +0530)
committerKotresh HR <khiremat@redhat.com>
Tue, 7 Jul 2026 08:44:53 +0000 (14:14 +0530)
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 <khiremat@redhat.com>
src/tools/cephfs_mirror/PeerReplayer.cc

index 8cb8dbdd183ba37b8d8802cb90d8c343e2762da9..8c8fc3259fdd0bc78b12b210e52d7c13282e87b7 100644 (file)
@@ -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;