dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0020-Assemble-Fix-starting-array-with-initial-reshape-che.patch

8fbece
From 2b57e4fe041d52ae29866c93a878a11c07223cff Mon Sep 17 00:00:00 2001
8fbece
From: Pawel Baldysiak <pawel.baldysiak@intel.com>
8fbece
Date: Fri, 22 Feb 2019 12:56:27 +0100
8fbece
Subject: [RHEL7.7 PATCH 20/24] Assemble: Fix starting array with initial
8fbece
 reshape checkpoint
8fbece
8fbece
If array was stopped during reshape initialization,
8fbece
there might be a "0" checkpoint recorded in metadata.
8fbece
If array with such condition (reshape with position 0)
8fbece
is passed to kernel - it will refuse to start such array.
8fbece
8fbece
Treat such array as normal during assemble, Grow_continue() will
8fbece
reinitialize and start the reshape.
8fbece
8fbece
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
8fbece
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
8fbece
---
8fbece
 Assemble.c | 18 ++++++++++++++++--
8fbece
 1 file changed, 16 insertions(+), 2 deletions(-)
8fbece
8fbece
diff --git a/Assemble.c b/Assemble.c
8fbece
index 9f050c1..420c7b3 100644
8fbece
--- a/Assemble.c
8fbece
+++ b/Assemble.c
8fbece
@@ -2061,8 +2061,22 @@ int assemble_container_content(struct supertype *st, int mdfd,
8fbece
 				   spare, &c->backup_file, c->verbose) == 1)
8fbece
 			return 1;
8fbece
 
8fbece
-		err = sysfs_set_str(content, NULL,
8fbece
-				    "array_state", "readonly");
8fbece
+		if (content->reshape_progress == 0) {
8fbece
+			/* If reshape progress is 0 - we are assembling the
8fbece
+			 * array that was stopped, before reshape has started.
8fbece
+			 * Array needs to be started as active, Grow_continue()
8fbece
+			 * will start the reshape.
8fbece
+			 */
8fbece
+			sysfs_set_num(content, NULL, "reshape_position",
8fbece
+				      MaxSector);
8fbece
+			err = sysfs_set_str(content, NULL,
8fbece
+					    "array_state", "active");
8fbece
+			sysfs_set_num(content, NULL, "reshape_position", 0);
8fbece
+		} else {
8fbece
+			err = sysfs_set_str(content, NULL,
8fbece
+					    "array_state", "readonly");
8fbece
+		}
8fbece
+
8fbece
 		if (err)
8fbece
 			return 1;
8fbece
 
8fbece
-- 
8fbece
2.7.5
8fbece