public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Diederik de Haas <didi.debian@cknow.org>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Adam Borowski <kilobyte@angband.pl>,
	Nicholas D Steeves <sten@debian.org>,
	Debian kernel ML <debian-kernel@lists.debian.org>
Subject: btrfs: Kernel warning when using/mount RAID 5/6
Date: Sun, 17 Mar 2024 18:38:55 +0100	[thread overview]
Message-ID: <4105665.mVaztBssJx@bagend> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1226 bytes --]

Hi,

Since https://bugs.debian.org/863290 (2017) the Debian kernel has had a
patch to warn about the use of RAID 5/6 with BTRFS.
That bug mentions "It looks like there's a consensus that such a warning
should live in the kernel rather than userland"

Via [1] and [2] it seems userland did get a warning. It is mentioned in
the kernel documentation (``Documentation/btrfs-man5.rst``) (and [3]
and [4]), but AFAICT users are still not warned by the kernel when
using RAID 5/6.

I stumbled upon this issue when I was (locally) rebasing the Debian kernel
patch for kernel 6.8. I attached my rebased version of the original patch.
(I may have done it completely wrong as I know very little about BTRFS.)

But more importantly, IMO such a warning shouldn't be in a downstream
kernel (Debian), but in the upstream kernel source?

Cheers,
  Diederik

[1] https://lore.kernel.org/linux-btrfs/20161208153004.GA31795@angband.pl/
[2] https://lore.kernel.org/linux-btrfs/bf9594ea55ce40af80548888070427ad97daf78a.1598374255.git.josef@toxicpanda.com/
[3] https://btrfs.readthedocs.io/en/latest/btrfs-man5.html#raid56-status-and-recommended-practices
[4] https://lore.kernel.org/linux-btrfs/dbf47c42-932c-9cf0-0e50-75f1d779d024@cryptearth.de/

[-- Attachment #1.2: btrfs-warn-about-raid5-6-being-experimental-at-mount.patch --]
[-- Type: text/x-patch, Size: 1841 bytes --]

From: Adam Borowski <kilobyte@angband.pl>
Date: Tue, 28 Mar 2017 16:55:05 +0200
Subject: btrfs: warn about RAID5/6 being experimental at mount time
Bug-Debian: https://bugs.debian.org/863290
Origin: https://bugs.debian.org/863290#5

Too many people come complaining about losing their data -- and indeed,
there's no warning outside a wiki and the mailing list tribal knowledge.
Message severity chosen for consistency with XFS -- "alert" makes dmesg
produce nice red background which should get the point across.

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
[bwh: Also add_taint() so this is flagged in bug reports]
[2023-01-10: still accurate according to btrfs-progs own manpage:
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=922797e15590b836e377d6dc47b828356cafc2a9]
[2024-03-17: still accurate; manpage is now in Documentation/btrfs-man5.rst
implementation went from disk-io.c to super.c]
---
 fs/btrfs/super.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 101f786963d4..2c409bce1bf5 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -731,6 +731,18 @@ static void set_device_specific_options(struct btrfs_fs_info *fs_info)
 	    !fs_info->fs_devices->rotating)
 		btrfs_set_opt(fs_info->mount_opt, SSD);
 
+	/*
+	 * Warn about RAID5/6 being experimental at mount time
+	 */
+	if ((fs_info->avail_data_alloc_bits |
+	     fs_info->avail_metadata_alloc_bits |
+	     fs_info->avail_system_alloc_bits) &
+	    BTRFS_BLOCK_GROUP_RAID56_MASK) {
+		btrfs_alert(fs_info,
+		"btrfs RAID5/6 is EXPERIMENTAL and has known data-loss bugs");
+		add_taint(TAINT_AUX, LOCKDEP_STILL_OK);
+	}
+
 	/*
 	 * For devices supporting discard turn on discard=async automatically,
 	 * unless it's already set or disabled. This could be turned off by

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

                 reply	other threads:[~2024-03-17 17:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4105665.mVaztBssJx@bagend \
    --to=didi.debian@cknow.org \
    --cc=clm@fb.com \
    --cc=debian-kernel@lists.debian.org \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kilobyte@angband.pl \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sten@debian.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