From: Jan Andres <jandres@gmx.net>
To: linux-btrfs@vger.kernel.org
Subject: security.capability xattr missing after btrfs send/receive
Date: Sun, 1 Feb 2015 13:13:36 +0100 [thread overview]
Message-ID: <20150201121335.GA4599@pitr.home.jan> (raw)
I found that the security.capability xattr gets lost when cloning a
subvolume via btrfs send | btrfs receive. This is easy to reproduce
(currently on 3.19.0-rc6, x86_64, with btrfs-progs 3.18.1):
Have two btrfs file systems, "/fs1" and "/fs2".
# btrfs sub create /fs1/test
# touch /fs1/test/foo
# setcap cap_net_admin+ep /fs1/test/foo
# getcap /fs1/test/foo
/fs1/test/foo = cap_net_admin+ep
# btrfs prop set /fs1/test ro true
# btrfs send /fs1/test | btrfs receive /fs2
# getcap /fs2/test/foo
[reports nothing]
The cause of the problem seems to be that BTRFS_SEND_C_SET_XATTR comes
before BTRFS_SEND_C_CHMOD in the send stream, so that the receiving end
will first correctly restore all the xattrs of the file, and after that,
perform an lchown() which will cause the kernel to reset the
file's capabilities.
I don't know how to fix this correctly (especially in the case of
incremental sends), so I don't have a patch, but figured it might be
useful to share what I found.
Regards,
Jan
--
Jan Andres <jandres@gmx.net>
next reply other threads:[~2015-02-01 12:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-01 12:13 Jan Andres [this message]
2015-02-01 17:15 ` security.capability xattr missing after btrfs send/receive Juan Orti
2015-02-01 17:57 ` Chris Murphy
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=20150201121335.GA4599@pitr.home.jan \
--to=jandres@gmx.net \
--cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox