Blob Blame History Raw
From 9a260cc0355661947dbba6929412662ed6d71d31 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@centosproject.org>
Date: Wed, 1 Sep 2021 19:25:55 -0400
Subject: [PATCH] balance, mkfs: Disable raid56 modes

The RAID 5/6 modes in Btrfs are not yet suitable for production use,
so it is disabled.

Signed-off-by: Neal Gompa <ngompa@centosproject.org>
---
 cmds/balance.c | 37 +++++--------------------------------
 mkfs/main.c    |  4 ++--
 2 files changed, 7 insertions(+), 34 deletions(-)

diff --git a/cmds/balance.c b/cmds/balance.c
index 33cbb91c..43ce19e8 100644
--- a/cmds/balance.c
+++ b/cmds/balance.c
@@ -503,8 +503,7 @@ static const char * const cmd_balance_start_usage[] = {
 	"-d[filters]    act on data chunks",
 	"-m[filters]    act on metadata chunks",
 	"-s[filters]    act on system chunks (only under -f)",
-	"-f             force a reduction of metadata integrity, or",
-	"               skip timeout when converting to RAID56 profiles",
+	"-f             force a reduction of metadata integrity",
 	"--full-balance do not print warning and do not delay start",
 	"--background|--bg",
 	"               run the balance as a background process",
@@ -527,7 +526,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
 	int background = 0;
 	bool enqueue = false;
 	unsigned start_flags = 0;
-	bool raid56_warned = false;
 	int i;
 
 	memset(&args, 0, sizeof(args));
@@ -634,8 +632,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
 
 	/* soft makes sense only when convert for corresponding type is set */
 	for (i = 0; ptrs[i]; i++) {
-		int delay = 10;
-
 		if ((ptrs[i]->flags & BTRFS_BALANCE_ARGS_SOFT) &&
 		    !(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT)) {
 			error("'soft' option can be used only when converting profiles");
@@ -645,34 +641,11 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
 		if (!(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT))
 			continue;
 
-		if (!(ptrs[i]->target & (BTRFS_BLOCK_GROUP_RAID6 |
-					   BTRFS_BLOCK_GROUP_RAID5)))
-			continue;
-
-		if (raid56_warned)
-			continue;
-
-		raid56_warned = true;
-		printf("WARNING:\n\n");
-		printf("\tRAID5/6 support has known problems and is strongly discouraged\n");
-		printf("\tto be used besides testing or evaluation. It is recommended that\n");
-		printf("\tyou use one of the other RAID profiles.\n");
-		/*
-		 * Override timeout by the --force option too, though it's
-		 * otherwise used for allowing redundancy reduction.
-		 */
-		if (force) {
-			printf("\tSafety timeout skipped due to --force\n\n");
-			continue;
-		}
-		printf("\tThe operation will continue in %d seconds.\n", delay);
-		printf("\tUse Ctrl-C to stop.\n");
-		while (delay) {
-			printf("%2d", delay--);
-			fflush(stdout);
-			sleep(1);
+		if (ptrs[i]->target & (BTRFS_BLOCK_GROUP_RAID6 |
+				       BTRFS_BLOCK_GROUP_RAID5)) {
+			error("RAID5/6 support has known problems and is disabled.");
+			return 1;
 		}
-		printf("\nStarting conversion to RAID5/6.\n");
 	}
 
 	if (!(start_flags & BALANCE_START_FILTERS) && !(start_flags & BALANCE_START_NOWARN)) {
diff --git a/mkfs/main.c b/mkfs/main.c
index eab93eb3..72cb8dc6 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1190,8 +1190,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
 	if ((data_profile | metadata_profile) &
 	    (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)) {
 		features |= BTRFS_FEATURE_INCOMPAT_RAID56;
-		warning("RAID5/6 support has known problems is strongly discouraged\n"
-			"\t to be used besides testing or evaluation.\n");
+		error("RAID5/6 support has known problems and is disabled.");
+		exit(1);
 	}
 
 	if ((data_profile | metadata_profile) &
-- 
2.31.1