borisb / rpms / btrfs-progs

Forked from rpms/btrfs-progs 2 years ago
Clone
Blob Blame History Raw
From 1338ce1136aea6cc83f7ee6d78c5ca6a07bb38d6 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 | 35 ++++-------------------------------
 mkfs/main.c    |  4 ++--
 2 files changed, 6 insertions(+), 33 deletions(-)

diff --git a/cmds/balance.c b/cmds/balance.c
index 7abc69d9..ab86ff36 100644
--- a/cmds/balance.c
+++ b/cmds/balance.c
@@ -376,8 +376,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",
@@ -400,7 +399,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));
@@ -507,8 +505,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");
@@ -518,33 +514,10 @@ 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_RAID56_MASK))
-			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;
+		if (ptrs[i]->target & BTRFS_BLOCK_GROUP_RAID56_MASK) {
+			error("RAID5/6 support has known problems and is disabled.");
+			return 1;
 		}
-		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);
-		}
-		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 f9e8be74..11c0fc26 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1214,8 +1214,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
 
 	if ((data_profile | metadata_profile) & BTRFS_BLOCK_GROUP_RAID56_MASK) {
 		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.35.1