borisb / rpms / btrfs-progs

Forked from rpms/btrfs-progs 2 years ago
Clone
5620eb
From 349ea14a32ab63555cff47440f178ed01870e3f6 Mon Sep 17 00:00:00 2001
5620eb
From: Neal Gompa <ngompa@centosproject.org>
5620eb
Date: Wed, 1 Sep 2021 19:25:55 -0400
5620eb
Subject: [PATCH] balance, mkfs: Disable raid56 modes
5620eb
5620eb
The RAID 5/6 modes in Btrfs are not yet suitable for production use,
5620eb
so it is disabled.
5620eb
5620eb
Signed-off-by: Neal Gompa <ngompa@centosproject.org>
5620eb
---
5620eb
 cmds/balance.c | 35 ++++-------------------------------
5620eb
 mkfs/main.c    |  4 ++--
5620eb
 2 files changed, 6 insertions(+), 33 deletions(-)
5620eb
5620eb
diff --git a/cmds/balance.c b/cmds/balance.c
5620eb
index 7abc69d9..ab86ff36 100644
5620eb
--- a/cmds/balance.c
5620eb
+++ b/cmds/balance.c
5620eb
@@ -376,8 +376,7 @@ static const char * const cmd_balance_start_usage[] = {
5620eb
 	"-d[filters]    act on data chunks",
5620eb
 	"-m[filters]    act on metadata chunks",
5620eb
 	"-s[filters]    act on system chunks (only under -f)",
5620eb
-	"-f             force a reduction of metadata integrity, or",
5620eb
-	"               skip timeout when converting to RAID56 profiles",
5620eb
+	"-f             force a reduction of metadata integrity",
5620eb
 	"--full-balance do not print warning and do not delay start",
5620eb
 	"--background|--bg",
5620eb
 	"               run the balance as a background process",
5620eb
@@ -400,7 +399,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
5620eb
 	int background = 0;
5620eb
 	bool enqueue = false;
5620eb
 	unsigned start_flags = 0;
5620eb
-	bool raid56_warned = false;
5620eb
 	int i;
5620eb
 
5620eb
 	memset(&args, 0, sizeof(args));
5620eb
@@ -507,8 +505,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
5620eb
 
5620eb
 	/* soft makes sense only when convert for corresponding type is set */
5620eb
 	for (i = 0; ptrs[i]; i++) {
5620eb
-		int delay = 10;
5620eb
-
5620eb
 		if ((ptrs[i]->flags & BTRFS_BALANCE_ARGS_SOFT) &&
5620eb
 		    !(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT)) {
5620eb
 			error("'soft' option can be used only when converting profiles");
5620eb
@@ -518,33 +514,10 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
5620eb
 		if (!(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT))
5620eb
 			continue;
5620eb
 
5620eb
-		if (!(ptrs[i]->target & BTRFS_BLOCK_GROUP_RAID56_MASK))
5620eb
-			continue;
5620eb
-
5620eb
-		if (raid56_warned)
5620eb
-			continue;
5620eb
-
5620eb
-		raid56_warned = true;
5620eb
-		printf("WARNING:\n\n");
5620eb
-		printf("\tRAID5/6 support has known problems and is strongly discouraged\n");
5620eb
-		printf("\tto be used besides testing or evaluation. It is recommended that\n");
5620eb
-		printf("\tyou use one of the other RAID profiles.\n");
5620eb
-		/*
5620eb
-		 * Override timeout by the --force option too, though it's
5620eb
-		 * otherwise used for allowing redundancy reduction.
5620eb
-		 */
5620eb
-		if (force) {
5620eb
-			printf("\tSafety timeout skipped due to --force\n\n");
5620eb
-			continue;
5620eb
-		}
5620eb
-		printf("\tThe operation will continue in %d seconds.\n", delay);
5620eb
-		printf("\tUse Ctrl-C to stop.\n");
5620eb
-		while (delay) {
5620eb
-			printf("%2d", delay--);
5620eb
-			fflush(stdout);
5620eb
-			sleep(1);
5620eb
+		if (ptrs[i]->target & BTRFS_BLOCK_GROUP_RAID56_MASK) {
5620eb
+			error("RAID5/6 support has known problems and is disabled.");
5620eb
+			return 1;
5620eb
 		}
5620eb
-		printf("\nStarting conversion to RAID5/6.\n");
5620eb
 	}
5620eb
 
5620eb
 	if (!(start_flags & BALANCE_START_FILTERS) && !(start_flags & BALANCE_START_NOWARN)) {
5620eb
diff --git a/mkfs/main.c b/mkfs/main.c
5620eb
index 4d50bd25..5f66e6ae 100644
5620eb
--- a/mkfs/main.c
5620eb
+++ b/mkfs/main.c
5620eb
@@ -1176,8 +1176,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
5620eb
 
5620eb
 	if ((data_profile | metadata_profile) & BTRFS_BLOCK_GROUP_RAID56_MASK) {
5620eb
 		features |= BTRFS_FEATURE_INCOMPAT_RAID56;
5620eb
-		warning("RAID5/6 support has known problems is strongly discouraged\n"
5620eb
-			"\t to be used besides testing or evaluation.\n");
5620eb
+		error("RAID5/6 support has known problems and is disabled.");
5620eb
+		exit(1);
5620eb
 	}
5620eb
 
5620eb
 	if ((data_profile | metadata_profile) &
5620eb
-- 
5620eb
2.31.1
5620eb