[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260206182336.1397715-43-neelx@suse.com>
Date: Fri, 6 Feb 2026 19:23:14 +0100
From: Daniel Vacek <neelx@...e.com>
To: Chris Mason <clm@...com>,
Josef Bacik <josef@...icpanda.com>,
Eric Biggers <ebiggers@...nel.org>,
"Theodore Y. Ts'o" <tytso@....edu>,
Jaegeuk Kim <jaegeuk@...nel.org>,
Jens Axboe <axboe@...nel.dk>,
David Sterba <dsterba@...e.com>
Cc: linux-block@...r.kernel.org,
Daniel Vacek <neelx@...e.com>,
linux-fscrypt@...r.kernel.org,
linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v6 42/43] btrfs: disable encryption on RAID5/6
From: Josef Bacik <josef@...icpanda.com>
The RAID5/6 code will re-arrange bios and submit them through a
different mechanism. This is problematic with inline encryption as we
have to get the bio and csum it after it's been encrypted, and the
radi5/6 bio's don't have the btrfs_bio embedded, so we have no way to
get the csums put on disk.
This isn't an unsolvable problem, but would require a bit of reworking.
Since we discourage users from using this code currently simply don't
allow encryption on RAID5/6 setups. If there's sufficient demand in the
future we can add the support for this.
Signed-off-by: Josef Bacik <josef@...icpanda.com>
Signed-off-by: Daniel Vacek <neelx@...e.com>
---
v5: https://lore.kernel.org/linux-btrfs/941f02bb923edadae1aea4ae3e5aa6ba05d1215a.1706116485.git.josef@toxicpanda.com/
* No changes since.
---
fs/btrfs/ioctl.c | 4 ++++
fs/btrfs/super.c | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index a8adf99ad0a8..1bade8fea16e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -5198,6 +5198,10 @@ long btrfs_ioctl(struct file *file, unsigned int
return -EOPNOTSUPP;
if (sb_rdonly(fs_info->sb))
return -EROFS;
+ if (btrfs_fs_incompat(fs_info, RAID56)) {
+ btrfs_warn(fs_info, "can't enable encryption with RAID5/6");
+ return -EINVAL;
+ }
/*
* If we crash before we commit, nothing encrypted could have
* been written so it doesn't matter whether the encrypted
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 4a2887147ead..aefcbe56e85a 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -734,6 +734,12 @@ bool btrfs_check_options(const struct btrfs_fs_info *info,
if (btrfs_check_mountopts_zoned(info, mount_opt))
ret = false;
+ if (btrfs_fs_incompat(info, RAID56) &&
+ btrfs_raw_test_opt(*mount_opt, TEST_DUMMY_ENCRYPTION)) {
+ btrfs_err(info, "cannot use test_dummy_encryption with RAID5/6");
+ ret = false;
+ }
+
if (!test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state)) {
if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE)) {
btrfs_warn(info,
--
2.51.0
Powered by blists - more mailing lists