osandov / rpms / btrfs-progs

Forked from rpms/btrfs-progs 2 years ago
Clone
Blob Blame History Raw
From da8af64d371e314acb2fec2052f1e1312822fb51 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@centosproject.org>
Date: Fri, 14 May 2021 18:14:37 -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 | 33 ++++-----------------------------
 mkfs/main.c    |  4 ++--
 2 files changed, 6 insertions(+), 31 deletions(-)

diff --git a/cmds/balance.c b/cmds/balance.c
index 33cbb91c..2e6c3b2d 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));
@@ -646,33 +644,10 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
 			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);
+					   BTRFS_BLOCK_GROUP_RAID5))) {
+			error("\tRAID5/6 support has known problems and is disabled.\n");
+			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 d2322faf..81519c6a 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.\n");
+		exit(1);
 	}
 
 	if ((data_profile | metadata_profile) &
-- 
2.31.1