mirror of
https://github.com/ceph/ceph
synced 2026-08-02 07:03:18 +00:00
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 <khiremat@redhat.com>
This commit is contained in:
parent
6c89866b53
commit
f2ee574aab
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user