[PATCH 2/7] FIX: reshape in md should wait for monitoring process (external metadata)

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

 



When container content is assembled it is possible that reshape
is in progress. To avoid md to run reshape without monitoring.
Before setting array parameters sync_max is set to 0, to not allow md
for any move forward. After array parameters are set, sync_max is set to current
reshape_progress. This is current reshape start point.
Note that md is still blocked, and reshape is not continued.

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

 Assemble.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/Assemble.c b/Assemble.c
index 4d41081..6aff049 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1510,11 +1510,26 @@ int assemble_container_content(struct supertype *st, int mdfd,
 	sysfs_init(content, mdfd, 0);
 
 	sra = sysfs_read(mdfd, 0, GET_VERSION);
-	if (sra == NULL || strcmp(sra->text_version, content->text_version) != 0)
+	if (sra == NULL || strcmp(sra->text_version,
+				  content->text_version) != 0) {
+		if (content->reshape_active) {
+			/* block reshape until reshape monitoring
+			 * allows for run
+			 */
+			sysfs_set_num(content, NULL, "sync_max", 0);
+		}
 		if (sysfs_set_array(content, md_get_version(mdfd)) != 0) {
 			close(mdfd);
 			return 1;
 		}
+		if (content->reshape_active) {
+			/* set the current checkpoint to allow monitoring to
+			 * restart reshape
+			 */
+			sysfs_set_num(content, NULL, "sync_max",
+				      content->reshape_progress);
+		}
+	}
 	if (sra)
 		sysfs_free(sra);
 

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