X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Ftools%2Fcephfs_mirror%2FPeerReplayer.cc;h=bd47046bb12184da66f2c9a74aeccf4bcd91f6f2;hb=aee94f6923ba628a85d855d0c5316d0da78bfa2a;hp=66a141f8578d92dea954284996b381d9ee2da054;hpb=27f45121cc74e31203777ad565f78d8aad9b92a2;p=ceph.git diff --git a/ceph/src/tools/cephfs_mirror/PeerReplayer.cc b/ceph/src/tools/cephfs_mirror/PeerReplayer.cc index 66a141f85..bd47046bb 100644 --- a/ceph/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/ceph/src/tools/cephfs_mirror/PeerReplayer.cc @@ -1128,6 +1128,27 @@ int PeerReplayer::pre_sync_check_and_open_handles( return 0; } +// sync the mode of the remote dir_root with that of the local dir_root +int PeerReplayer::sync_perms(const std::string& path) { + int r = 0; + struct ceph_statx tstx; + + r = ceph_statx(m_local_mount, path.c_str(), &tstx, CEPH_STATX_MODE, + AT_STATX_DONT_SYNC | AT_SYMLINK_NOFOLLOW); + if (r < 0) { + derr << ": failed to fetch stat for local path: " + << cpp_strerror(r) << dendl; + return r; + } + r = ceph_chmod(m_remote_mount, path.c_str(), tstx.stx_mode); + if (r < 0) { + derr << ": failed to set mode for remote path: " + << cpp_strerror(r) << dendl; + return r; + } + return 0; +} + void PeerReplayer::post_sync_close_handles(const FHandles &fh) { dout(20) << dendl; @@ -1499,8 +1520,13 @@ void PeerReplayer::run(SnapshotReplayerThread *replayer) { dout(5) << ": picked dir_root=" << *dir_root << dendl; int r = register_directory(*dir_root, replayer); if (r == 0) { - sync_snaps(*dir_root, locker); - unregister_directory(*dir_root); + r = sync_perms(*dir_root); + if (r < 0) { + _inc_failed_count(*dir_root); + } else { + sync_snaps(*dir_root, locker); + } + unregister_directory(*dir_root); } }