From: Venky Shankar Date: Tue, 4 May 2021 10:56:58 +0000 (-0400) Subject: cephfs-mirror: synchronize file mode X-Git-Tag: v17.1.0~1820^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=06c2652366eb4d67ea0e0c866150e9e81f2abc67;p=ceph-ci.git cephfs-mirror: synchronize file mode Signed-off-by: Venky Shankar --- diff --git a/src/tools/cephfs_mirror/PeerReplayer.cc b/src/tools/cephfs_mirror/PeerReplayer.cc index ee82efbb6e1..ac0b10ba54c 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/src/tools/cephfs_mirror/PeerReplayer.cc @@ -560,6 +560,14 @@ int PeerReplayer::remote_mkdir(const std::string &epath, const struct ceph_statx return r; } + r = ceph_chmodat(m_remote_mount, fh.r_fd_dir_root, epath.c_str(), stx.stx_mode & ~S_IFMT, + AT_SYMLINK_NOFOLLOW); + if (r < 0) { + derr << ": failed to chmod remote directory=" << epath << ": " << cpp_strerror(r) + << dendl; + return r; + } + struct timespec times[] = {{stx.stx_atime.tv_sec, stx.stx_atime.tv_nsec}, {stx.stx_mtime.tv_sec, stx.stx_mtime.tv_nsec}}; r = ceph_utimensat(m_remote_mount, fh.r_fd_dir_root, epath.c_str(), times, AT_SYMLINK_NOFOLLOW); @@ -721,6 +729,14 @@ int PeerReplayer::remote_file_op(const std::string &dir_root, const std::string return r; } + r = ceph_chmodat(m_remote_mount, fh.r_fd_dir_root, epath.c_str(), stx.stx_mode & ~S_IFMT, + AT_SYMLINK_NOFOLLOW); + if (r < 0) { + derr << ": failed to chmod remote directory=" << epath << ": " << cpp_strerror(r) + << dendl; + return r; + } + struct timespec times[] = {{stx.stx_atime.tv_sec, stx.stx_atime.tv_nsec}, {stx.stx_mtime.tv_sec, stx.stx_mtime.tv_nsec}}; r = ceph_utimensat(m_remote_mount, fh.r_fd_dir_root, epath.c_str(), times, AT_SYMLINK_NOFOLLOW);