summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
authorAlex Lyakas <alex.btrfs@zadarastorage.com>2012-10-17 13:52:47 +0000
committerChris Mason <chris.mason@fusionio.com>2012-10-25 15:47:31 -0400
commite2d044fe77f8e845333bb1bd29587dc08a4346a0 (patch)
treef0d30e2900224d39dbe4cceabe116f2d7a8305f4 /fs/btrfs/send.c
parent671415b7db49f62896f0b6d50fc4f312a0512983 (diff)
downloadop-kernel-dev-e2d044fe77f8e845333bb1bd29587dc08a4346a0.zip
op-kernel-dev-e2d044fe77f8e845333bb1bd29587dc08a4346a0.tar.gz
Btrfs: Send: preserve ownership (uid and gid) also for symlinks.
This patch also requires a change in the user-space part of "receive". We need to use "lchown" instead of "chown". We will do this in the following patch. Signed-off-by: Alex Lyakas <alex.btrfs@zadarastorage.com> if (S_ISREG(sctx->cur_inode_mode)) {
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 97cc539..e78b297 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -4067,22 +4067,21 @@ static int finish_inode_if_needed(struct send_ctx *sctx, int at_end)
if (ret < 0)
goto out;
- if (!S_ISLNK(sctx->cur_inode_mode)) {
- if (!sctx->parent_root || sctx->cur_inode_new) {
+ if (!sctx->parent_root || sctx->cur_inode_new) {
+ need_chown = 1;
+ if (!S_ISLNK(sctx->cur_inode_mode))
need_chmod = 1;
- need_chown = 1;
- } else {
- ret = get_inode_info(sctx->parent_root, sctx->cur_ino,
- NULL, NULL, &right_mode, &right_uid,
- &right_gid, NULL);
- if (ret < 0)
- goto out;
+ } else {
+ ret = get_inode_info(sctx->parent_root, sctx->cur_ino,
+ NULL, NULL, &right_mode, &right_uid,
+ &right_gid, NULL);
+ if (ret < 0)
+ goto out;
- if (left_uid != right_uid || left_gid != right_gid)
- need_chown = 1;
- if (left_mode != right_mode)
- need_chmod = 1;
- }
+ if (left_uid != right_uid || left_gid != right_gid)
+ need_chown = 1;
+ if (!S_ISLNK(sctx->cur_inode_mode) && left_mode != right_mode)
+ need_chmod = 1;
}
if (S_ISREG(sctx->cur_inode_mode)) {
OpenPOWER on IntegriCloud