osandov / rpms / btrfs-progs

Forked from rpms/btrfs-progs 2 years ago
Clone
23e2ef
From 9a260cc0355661947dbba6929412662ed6d71d31 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
---
23e2ef
 cmds/balance.c | 37 +++++--------------------------------
71c8ec
 mkfs/main.c    |  4 ++--
23e2ef
 2 files changed, 7 insertions(+), 34 deletions(-)
71c8ec
71c8ec
diff --git a/cmds/balance.c b/cmds/balance.c
23e2ef
index 33cbb91c..43ce19e8 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));
23e2ef
@@ -634,8 +632,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");
23e2ef
@@ -645,34 +641,11 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
23e2ef
 		if (!(ptrs[i]->flags & BTRFS_BALANCE_ARGS_CONVERT))
71c8ec
 			continue;
71c8ec
 
23e2ef
-		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);
23e2ef
+		if (ptrs[i]->target & (BTRFS_BLOCK_GROUP_RAID6 |
23e2ef
+				       BTRFS_BLOCK_GROUP_RAID5)) {
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
23e2ef
index eab93eb3..72cb8dc6 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");
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