borisb / rpms / btrfs-progs

Forked from rpms/btrfs-progs 2 years ago
Clone
71c8ec
From da8af64d371e314acb2fec2052f1e1312822fb51 Mon Sep 17 00:00:00 2001
71c8ec
From: Neal Gompa <ngompa@centosproject.org>
71c8ec
Date: Fri, 14 May 2021 18:14:37 -0400
71c8ec
Subject: [PATCH] balance, mkfs: Disable raid56 modes
71c8ec
71c8ec
The RAID 5/6 modes in Btrfs are not yet suitable for production use,
71c8ec
so it is disabled.
71c8ec
71c8ec
Signed-off-by: Neal Gompa <ngompa@centosproject.org>
71c8ec
---
71c8ec
 cmds/balance.c | 33 ++++-----------------------------
71c8ec
 mkfs/main.c    |  4 ++--
71c8ec
 2 files changed, 6 insertions(+), 31 deletions(-)
71c8ec
71c8ec
diff --git a/cmds/balance.c b/cmds/balance.c
71c8ec
index 33cbb91c..2e6c3b2d 100644
71c8ec
--- a/cmds/balance.c
71c8ec
+++ b/cmds/balance.c
71c8ec
@@ -503,8 +503,7 @@ static const char * const cmd_balance_start_usage[] = {
71c8ec
 	"-d[filters]    act on data chunks",
71c8ec
 	"-m[filters]    act on metadata chunks",
71c8ec
 	"-s[filters]    act on system chunks (only under -f)",
71c8ec
-	"-f             force a reduction of metadata integrity, or",
71c8ec
-	"               skip timeout when converting to RAID56 profiles",
71c8ec
+	"-f             force a reduction of metadata integrity",
71c8ec
 	"--full-balance do not print warning and do not delay start",
71c8ec
 	"--background|--bg",
71c8ec
 	"               run the balance as a background process",
71c8ec
@@ -527,7 +526,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
71c8ec
 	int background = 0;
71c8ec
 	bool enqueue = false;
71c8ec
 	unsigned start_flags = 0;
71c8ec
-	bool raid56_warned = false;
71c8ec
 	int i;
71c8ec
 
71c8ec
 	memset(&args, 0, sizeof(args));
71c8ec
@@ -646,33 +644,10 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
71c8ec
 			continue;
71c8ec
 
71c8ec
 		if (!(ptrs[i]->target & (BTRFS_BLOCK_GROUP_RAID6 |
71c8ec
-					   BTRFS_BLOCK_GROUP_RAID5)))
71c8ec
-			continue;
71c8ec
-
71c8ec
-		if (raid56_warned)
71c8ec
-			continue;
71c8ec
-
71c8ec
-		raid56_warned = true;
71c8ec
-		printf("WARNING:\n\n");
71c8ec
-		printf("\tRAID5/6 support has known problems and is strongly discouraged\n");
71c8ec
-		printf("\tto be used besides testing or evaluation. It is recommended that\n");
71c8ec
-		printf("\tyou use one of the other RAID profiles.\n");
71c8ec
-		/*
71c8ec
-		 * Override timeout by the --force option too, though it's
71c8ec
-		 * otherwise used for allowing redundancy reduction.
71c8ec
-		 */
71c8ec
-		if (force) {
71c8ec
-			printf("\tSafety timeout skipped due to --force\n\n");
71c8ec
-			continue;
71c8ec
-		}
71c8ec
-		printf("\tThe operation will continue in %d seconds.\n", delay);
71c8ec
-		printf("\tUse Ctrl-C to stop.\n");
71c8ec
-		while (delay) {
71c8ec
-			printf("%2d", delay--);
71c8ec
-			fflush(stdout);
71c8ec
-			sleep(1);
71c8ec
+					   BTRFS_BLOCK_GROUP_RAID5))) {
71c8ec
+			error("\tRAID5/6 support has known problems and is disabled.\n");
71c8ec
+			return 1;
71c8ec
 		}
71c8ec
-		printf("\nStarting conversion to RAID5/6.\n");
71c8ec
 	}
71c8ec
 
71c8ec
 	if (!(start_flags & BALANCE_START_FILTERS) && !(start_flags & BALANCE_START_NOWARN)) {
71c8ec
diff --git a/mkfs/main.c b/mkfs/main.c
71c8ec
index d2322faf..81519c6a 100644
71c8ec
--- a/mkfs/main.c
71c8ec
+++ b/mkfs/main.c
71c8ec
@@ -1190,8 +1190,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
71c8ec
 	if ((data_profile | metadata_profile) &
71c8ec
 	    (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)) {
71c8ec
 		features |= BTRFS_FEATURE_INCOMPAT_RAID56;
71c8ec
-		warning("RAID5/6 support has known problems is strongly discouraged\n"
71c8ec
-			"\t to be used besides testing or evaluation.\n");
71c8ec
+		error("RAID5/6 support has known problems and is disabled.\n");
71c8ec
+		exit(1);
71c8ec
 	}
71c8ec
 
71c8ec
 	if ((data_profile | metadata_profile) &
71c8ec
-- 
71c8ec
2.31.1
71c8ec