[PATCH 08/14] Check if reshape can be restarted

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

 



When reshape was invoked during initramfs start-up stage
array is pushed in to reshape state already, so read only
state cannot be set again. To verify if reshape continuation should
be allowed sync_action sysfs key is tested and number of existing mdadm
instances is checked again.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 Grow.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/Grow.c b/Grow.c
index 4d2c361..b331287 100644
--- a/Grow.c
+++ b/Grow.c
@@ -3714,8 +3714,23 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
 	int err;
 
 	err = sysfs_set_str(info, NULL, "array_state", "readonly");
-	if (err)
-		return err;
+	if (err) {
+		/* check if array is set in to reshape stare,
+		 * and current mdadm instance is the only one
+		 */
+		if ((sysfs_get_str(info, NULL, "sync_action",
+				   buf, 40) == 8) &&
+		    (count_mdadms() == 1)) {
+			dprintf("Warning: Grow_continue() cannot set array in"
+				"to read only state [sync_action is %s].",
+				buf);
+			if (strncmp(buf, "reshape", 7))
+				return err;
+			dprintf("Allow to continue.\n");
+		} else
+			return err;
+	}
+
 	if (st->ss->external) {
 		fmt_devname(buf, st->container_dev);
 		container = buf;

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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