dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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