mdadm/0010-Assemble-Fix-starting-array-with-initial-reshape-che.patch
Zhiqiang Liu 0c2f4fd8eb mdadm: renumber patches
patches number counts from 6000. We renumber patches from 0.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
2020-06-29 22:06:27 +08:00

52 lines
1.6 KiB
Diff

From 2b57e4fe041d52ae29866c93a878a11c07223cff Mon Sep 17 00:00:00 2001
From: Pawel Baldysiak <pawel.baldysiak@intel.com>
Date: Fri, 22 Feb 2019 12:56:27 +0100
Subject: Assemble: Fix starting array with initial reshape checkpoint
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@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
Assemble.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index 816056d..3ddfa85 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -2047,8 +2047,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;
--
1.7.12.4