Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2d044fe authored by Alex Lyakas's avatar Alex Lyakas Committed by Chris Mason
Browse files

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: default avatarAlex Lyakas <alex.btrfs@zadarastorage.com>

 	if (S_ISREG(sctx->cur_inode_mode)) {
parent 671415b7
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
@@ -4067,10 +4067,10 @@ 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) {
			need_chmod = 1;
		need_chown = 1;
		if (!S_ISLNK(sctx->cur_inode_mode))
			need_chmod = 1;
	} else {
		ret = get_inode_info(sctx->parent_root, sctx->cur_ino,
				NULL, NULL, &right_mode, &right_uid,
@@ -4080,10 +4080,9 @@ static int finish_inode_if_needed(struct send_ctx *sctx, int at_end)

		if (left_uid != right_uid || left_gid != right_gid)
			need_chown = 1;
			if (left_mode != right_mode)
		if (!S_ISLNK(sctx->cur_inode_mode) && left_mode != right_mode)
			need_chmod = 1;
	}
	}

	if (S_ISREG(sctx->cur_inode_mode)) {
		ret = send_truncate(sctx, sctx->cur_ino, sctx->cur_inode_gen,