[PATCH 1/1] Assemble: Fix starting array with initial reshape checkpoint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If array was stopped during reshape initialization,
there might be a "0" checkpoint recorded in metadata.
If array with such condition (reshape with position 0)
is passed to kernel - it will refuse to start such array.

Treat such array as normal during assemble, Grow_continue() will
reinitialize and start the reshape.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@xxxxxxxxx>
---
 Assemble.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/Assemble.c b/Assemble.c
index 9f050c1f..420c7b39 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -2061,8 +2061,22 @@ int assemble_container_content(struct supertype *st, int mdfd,
 				   spare, &c->backup_file, c->verbose) == 1)
 			return 1;
 
-		err = sysfs_set_str(content, NULL,
-				    "array_state", "readonly");
+		if (content->reshape_progress == 0) {
+			/* If reshape progress is 0 - we are assembling the
+			 * array that was stopped, before reshape has started.
+			 * Array needs to be started as active, Grow_continue()
+			 * will start the reshape.
+			 */
+			sysfs_set_num(content, NULL, "reshape_position",
+				      MaxSector);
+			err = sysfs_set_str(content, NULL,
+					    "array_state", "active");
+			sysfs_set_num(content, NULL, "reshape_position", 0);
+		} else {
+			err = sysfs_set_str(content, NULL,
+					    "array_state", "readonly");
+		}
+
 		if (err)
 			return 1;
 
-- 
2.20.1




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux