btrfs: warn about RAID5/6 being experimental at mount time
authorAdam Borowski <kilobyte@angband.pl>
Tue, 28 Mar 2017 14:55:05 +0000 (16:55 +0200)
committerSalvatore Bonaccorso <carnil@debian.org>
Wed, 20 Jan 2021 16:40:43 +0000 (16:40 +0000)
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]

Gbp-Pq: Topic debian
Gbp-Pq: Name btrfs-warn-about-raid5-6-being-experimental-at-mount.patch

fs/btrfs/disk-io.c

index af97ddcc6b3e8710cf9a55a4064192b3b1027b81..b0f8da015a8c3a3b03dda97535653076acadbcd5 100644 (file)
@@ -3234,6 +3234,15 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
                btrfs_set_and_info(fs_info, SSD, "enabling ssd optimizations");
        }
 
+       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);
+       }
+
        /*
         * Mount does not set all options immediately, we can do it now and do
         * not have to wait for transaction commit