From: Sasha Levin <sashal@kernel.org>
To: gregkh@linuxfoundation.org
Cc: mpdesouza@suse.com, dsterba@suse.com, fdmanana@suse.com,
stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] btrfs: send: emit file capabilities after chown" failed to apply to 4.4-stable tree
Date: Thu, 18 Jun 2020 21:19:51 -0400 [thread overview]
Message-ID: <20200619011951.GU1931@sasha-vm> (raw)
In-Reply-To: <1592491523186218@kroah.com>
On Thu, Jun 18, 2020 at 04:45:23PM +0200, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 4.4-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From 89efda52e6b6930f80f5adda9c3c9edfb1397191 Mon Sep 17 00:00:00 2001
>From: Marcos Paulo de Souza <mpdesouza@suse.com>
>Date: Sun, 10 May 2020 23:15:07 -0300
>Subject: [PATCH] btrfs: send: emit file capabilities after chown
>
>Whenever a chown is executed, all capabilities of the file being touched
>are lost. When doing incremental send with a file with capabilities,
>there is a situation where the capability can be lost on the receiving
>side. The sequence of actions bellow shows the problem:
>
> $ mount /dev/sda fs1
> $ mount /dev/sdb fs2
>
> $ touch fs1/foo.bar
> $ setcap cap_sys_nice+ep fs1/foo.bar
> $ btrfs subvolume snapshot -r fs1 fs1/snap_init
> $ btrfs send fs1/snap_init | btrfs receive fs2
>
> $ chgrp adm fs1/foo.bar
> $ setcap cap_sys_nice+ep fs1/foo.bar
>
> $ btrfs subvolume snapshot -r fs1 fs1/snap_complete
> $ btrfs subvolume snapshot -r fs1 fs1/snap_incremental
>
> $ btrfs send fs1/snap_complete | btrfs receive fs2
> $ btrfs send -p fs1/snap_init fs1/snap_incremental | btrfs receive fs2
>
>At this point, only a chown was emitted by "btrfs send" since only the
>group was changed. This makes the cap_sys_nice capability to be dropped
>from fs2/snap_incremental/foo.bar
>
>To fix that, only emit capabilities after chown is emitted. The current
>code first checks for xattrs that are new/changed, emits them, and later
>emit the chown. Now, __process_new_xattr skips capabilities, letting
>only finish_inode_if_needed to emit them, if they exist, for the inode
>being processed.
>
>This behavior was being worked around in "btrfs receive" side by caching
>the capability and only applying it after chown. Now, xattrs are only
>emmited _after_ chown, making that workaround not needed anymore.
>
>Link: https://github.com/kdave/btrfs-progs/issues/202
>CC: stable@vger.kernel.org # 4.4+
>Suggested-by: Filipe Manana <fdmanana@suse.com>
>Reviewed-by: Filipe Manana <fdmanana@suse.com>
>Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
>Signed-off-by: David Sterba <dsterba@suse.com>
I took 1ec9a1ae1e30 ("Btrfs: fix unreplayable log after snapshot delete
+ parent dir fsync") to work around the conflict.
--
Thanks,
Sasha
next prev parent reply other threads:[~2020-06-19 1:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-18 14:45 FAILED: patch "[PATCH] btrfs: send: emit file capabilities after chown" failed to apply to 4.4-stable tree gregkh
2020-06-19 1:19 ` Sasha Levin [this message]
2020-06-19 8:11 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200619011951.GU1931@sasha-vm \
--to=sashal@kernel.org \
--cc=dsterba@suse.com \
--cc=fdmanana@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=mpdesouza@suse.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.