osandov / rpms / btrfs-progs

Forked from rpms/btrfs-progs 2 years ago
Clone
ae2607
From 349ea14a32ab63555cff47440f178ed01870e3f6 Mon Sep 17 00:00:00 2001
71c8ec
From: Neal Gompa <ngompa@centosproject.org>
23e2ef
Date: Wed, 1 Sep 2021 19:25:55 -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
---
ae2607
 cmds/balance.c | 35 ++++-------------------------------
71c8ec
 mkfs/main.c    |  4 ++--
ae2607
 2 files changed, 6 insertions(+), 33 deletions(-)
71c8ec
71c8ec
diff --git a/cmds/balance.c b/cmds/balance.c
ae2607
index 7abc69d9..ab86ff36 100644
71c8ec
--- a/cmds/balance.c
71c8ec
+++ b/cmds/balance.c
ae2607
@@ -376,8 +376,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",
ae2607
@@ -400,7 +399,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));
ae2607
@@ -507,8 +505,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
23e2ef
 
23e2ef
 	/* soft makes sense only when convert for corresponding type is set */
23e2ef
 	for (i = 0; ptrs[i]; i++) {
23e2ef
-		int delay = 10;
23e2ef
-
23e2ef
 		if ((ptrs[i]->flags & BTRFS_BALANCE_ARGS_SOFT) &&
23e2ef
 		    !(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT)) {
23e2ef
 			error("'soft' option can be used only when converting profiles");
ae2607
@@ -518,33 +514,10 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
23e2ef
 		if (!(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT))
71c8ec
 			continue;
71c8ec
 
ae2607
-		if (!(ptrs[i]->target & BTRFS_BLOCK_GROUP_RAID56_MASK))
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);
ae2607
+		if (ptrs[i]->target & BTRFS_BLOCK_GROUP_RAID56_MASK) {
23e2ef
+			error("RAID5/6 support has known problems and is disabled.");
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
ae2607
index 4d50bd25..5f66e6ae 100644
71c8ec
--- a/mkfs/main.c
71c8ec
+++ b/mkfs/main.c
ae2607
@@ -1176,8 +1176,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
ae2607
 
ae2607
 	if ((data_profile | metadata_profile) & BTRFS_BLOCK_GROUP_RAID56_MASK) {
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");
23e2ef
+		error("RAID5/6 support has known problems and is disabled.");
71c8ec
+		exit(1);
71c8ec
 	}
71c8ec
 
71c8ec
 	if ((data_profile | metadata_profile) &
71c8ec
-- 
71c8ec
2.31.1
71c8ec