dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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