]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephfs-mirror: synchronize file mode
authorVenky Shankar <vshankar@redhat.com>
Tue, 4 May 2021 10:56:58 +0000 (06:56 -0400)
committerVenky Shankar <vshankar@redhat.com>
Tue, 25 May 2021 12:44:44 +0000 (08:44 -0400)
Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/tools/cephfs_mirror/PeerReplayer.cc

index ee82efbb6e1149c63bab6b66331ccbb86d0cde85..ac0b10ba54caae1fb180549b57260e5a0dbdb7a4 100644 (file)
@@ -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);