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

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