[PATCH 13/14] Check if md allows to control reshape

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

 



It can happen that there is no mdadm in memory and 'max' was already
set to sync_max. Such array cannot be put under check pointing control
again.

Verify such situation and refuse to control array in such condition.

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

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

diff --git a/Grow.c b/Grow.c
index d54b8a8..04e6679 100644
--- a/Grow.c
+++ b/Grow.c
@@ -3656,6 +3656,7 @@ int Grow_continue_command(char *devname, int fd,
 	int spares;
 	int working_disks;
 	struct mdinfo *dev;
+	char buf[40];
 
 	dprintf("Grow continue from command line called for %s\n",
 		devname);
@@ -3769,6 +3770,24 @@ int Grow_continue_command(char *devname, int fd,
 		}
 	}
 
+	/* verify that array under reshape is stopped
+	 */
+	ret_val = sysfs_get_str(content, NULL, "sync_max", buf, 40);
+	if (ret_val <= 0) {
+		fprintf(stderr, Name
+			": cannot open verify reshape progress for %s (%i)\n",
+			content->sys_name, ret_val);
+		ret_val = 1;
+		goto Grow_continue_command_exit;
+	}
+	dprintf(Name ": Read sync_max sysfs entry is: %s\n", buf);
+	if (strncmp(buf, "max", 3) == 0) {
+		fprintf(stderr, Name ": md is not allowed to finish reshape "
+			"wihout mdadm assistance.\n");
+		ret_val = 1;
+		goto Grow_continue_command_exit;
+	}
+
 	/* continue reshape
 	 */
 	dev = content->devs;

--
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