From: Artur Paszkiewicz Date: Tue, 5 Jan 2016 16:16:16 +0000 (+0100) Subject: imsm: don't update migration record when reshape is interrupted X-Git-Tag: mdadm-3.4~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c85338c67570ec346bbd7fb0948bb0da4b43bcc3;p=thirdparty%2Fmdadm.git imsm: don't update migration record when reshape is interrupted Abort imsm_manage_reshape() without updating the migration record if any error occurs when checking progress. If reshape is interrupted and the migration record is then updated, the checkpoint will be wrong and will cause reshape to fail when the array is restarted. Signed-off-by: Artur Paszkiewicz Signed-off-by: NeilBrown --- diff --git a/super-intel.c b/super-intel.c index 3b3d561a..90b7b6de 100644 --- a/super-intel.c +++ b/super-intel.c @@ -10373,7 +10373,7 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) if (sysfs_fd_get_ll(fd, &completed) < 0) { dprintf("cannot read reshape_position (no reshape in progres)\n"); close(fd); - return 0; + return 1; } if (completed > position_to_set) { @@ -10662,7 +10662,7 @@ static int imsm_manage_reshape( sra->reshape_progress = next_step; /* wait until reshape finish */ - if (wait_for_reshape_imsm(sra, ndata) < 0) { + if (wait_for_reshape_imsm(sra, ndata)) { dprintf("wait_for_reshape_imsm returned error!\n"); goto abort; }