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

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