diff options
| author | Hengyu Liang <hengyul@cs.unc.edu> | 2026-10-11 11:58:15 -0400 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-10-30 23:13:51 +0100 |
| commit | 16b8f07d1ed50d4a8da468b56484873784dd8f4a (patch) | |
| tree | 166a794d68aa0fbddca0c723e53555bdb55543ad /scripts/Makefile.thinlto | |
| parent | 58e844c3ba387ceb0f527a6ba82aa50c81c4d7b7 (diff) | |
| download | linux-next-16b8f07d1ed50d4a8da468b56484873784dd8f4a.tar.gz linux-next-16b8f07d1ed50d4a8da468b56484873784dd8f4a.zip | |
btrfs: fix chattr failing on nodatasum files that have the compress flag
Commit cf1afec09e9f ("btrfs: validate properties before setting them")
made btrfs_set_prop() validate a property before setting it. For the
compression property, the validation fails with -EINVAL when the inode
has NODATASUM.
However, chattr writes back all the flags it read from the file, and
btrfs_fileattr_set() sets the compression property whenever the new
flags include FS_COMPR_FL, even when the compression flags do not
change. A file created on a filesystem mounted with nodatasum has
NODATASUM and still inherits the compress flag from its directory. As
of now, chattr fails on such a file when it changes any other flag.
The issue can be reproduced with:
mkfs.btrfs -f /dev/sdb
mount -o nodatasum /dev/sdb /mnt
mkdir /mnt/dir
chattr +c /mnt/dir
touch /mnt/dir/file
chattr +A /mnt/dir/file
Before commit cf1afec09e9f ("btrfs: validate properties before setting
them"), the last command succeeds.
After that commit, it fails with EINVAL.
This patch will make btrfs_fileattr_set() leave the compression flags
and the compression property alone when the call changes neither
FS_COMPR_FL nor FS_NOCOMP_FL.
Fixes: cf1afec09e9f ("btrfs: validate properties before setting them")
CC: stable@vger.kernel.org # 7.2+
Suggested-by: Qu Wenruo <wqu@suse.com>
Assisted-by: LLM
Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
