From 06c2652366eb4d67ea0e0c866150e9e81f2abc67 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Tue, 4 May 2021 06:56:58 -0400 Subject: [PATCH] cephfs-mirror: synchronize file mode Signed-off-by: Venky Shankar --- src/tools/cephfs_mirror/PeerReplayer.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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); -- 2.47.3