Blame SOURCES/mdadm-3.3.2-imsm-abort-reshape-if-sync_action-is-not-reshape.patch

efb5be
From d7d3809a1b93f9f7b7ca7d874c17632cb3305c76 Mon Sep 17 00:00:00 2001
efb5be
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
efb5be
Date: Wed, 23 Dec 2015 12:57:11 +0100
efb5be
Subject: [PATCH] imsm: abort reshape if sync_action is not "reshape"
efb5be
efb5be
When reshape was interrupted, an incorrect checkpoint would be saved in
efb5be
the migration record. Change wait_for_reshape_imsm() to return -1 when
efb5be
sync_action is not "reshape" to abort early in imsm_manage_reshape()
efb5be
without writing the migration record.
efb5be
efb5be
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
efb5be
Signed-off-by: NeilBrown <neilb@suse.com>
efb5be
---
efb5be
 super-intel.c | 6 ++++--
efb5be
 1 file changed, 4 insertions(+), 2 deletions(-)
efb5be
efb5be
diff --git a/super-intel.c b/super-intel.c
efb5be
index e609e0c..c7efa98 100644
efb5be
--- a/super-intel.c
efb5be
+++ b/super-intel.c
efb5be
@@ -10300,8 +10300,10 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
efb5be
 		sysfs_wait(fd, NULL);
efb5be
 		if (sysfs_get_str(sra, NULL, "sync_action",
efb5be
 				  action, 20) > 0 &&
efb5be
-				strncmp(action, "reshape", 7) != 0)
efb5be
-			break;
efb5be
+				strncmp(action, "reshape", 7) != 0) {
efb5be
+			close(fd);
efb5be
+			return -1;
efb5be
+		}
efb5be
 		if (sysfs_fd_get_ll(fd, &completed) < 0) {
efb5be
 			dprintf("imsm: wait_for_reshape_imsm() "
efb5be
 				"cannot read reshape_position (in loop)\n");