]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: abort reshape if sync_action is not "reshape"
authorArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Wed, 23 Dec 2015 11:57:11 +0000 (12:57 +0100)
committerNeilBrown <neilb@suse.com>
Wed, 23 Dec 2015 23:04:24 +0000 (10:04 +1100)
When reshape was interrupted, an incorrect checkpoint would be saved in
the migration record. Change wait_for_reshape_imsm() to return -1 when
sync_action is not "reshape" to abort early in imsm_manage_reshape()
without writing the migration record.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.com>
super-intel.c

index e609e0ca3a2dae9f80245cca78f8765ffebcc482..c7efa98f9bdbc446361b0ee534ec65c54163da49 100644 (file)
@@ -10300,8 +10300,10 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
                sysfs_wait(fd, NULL);
                if (sysfs_get_str(sra, NULL, "sync_action",
                                  action, 20) > 0 &&
-                               strncmp(action, "reshape", 7) != 0)
-                       break;
+                               strncmp(action, "reshape", 7) != 0) {
+                       close(fd);
+                       return -1;
+               }
                if (sysfs_fd_get_ll(fd, &completed) < 0) {
                        dprintf("cannot read reshape_position (in loop)\n");
                        close(fd);