From: Adam Kwolek Date: Thu, 9 Jun 2011 03:00:55 +0000 (+1000) Subject: imsm: FIX: Detect migration end during migration record saving X-Git-Tag: mdadm-3.2.2~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0228d92ca3bf1b6a8b2d6d5aef9bb64d82d103fe;p=thirdparty%2Fmdadm.git imsm: FIX: Detect migration end during migration record saving Checkpoint should be saved when migration is in progress only. End of reshape (based on passes status) should be detected and it should not cause abort of reshape/check-pointing/ operation. Signed-off-by: Adam Kwolek Signed-off-by: NeilBrown --- diff --git a/super-intel.c b/super-intel.c index ad5e79c6..974e7448 100644 --- a/super-intel.c +++ b/super-intel.c @@ -7759,6 +7759,8 @@ abort: * Returns: * 0: success * 1: failure + * 2: failure, means no valid migration record + * / no general migration in progress / ******************************************************************************/ int save_checkpoint_imsm(struct supertype *st, struct mdinfo *info, int state) { @@ -7770,8 +7772,8 @@ int save_checkpoint_imsm(struct supertype *st, struct mdinfo *info, int state) } if (__le32_to_cpu(super->migr_rec->blocks_per_unit) == 0) { - dprintf("ERROR: blocks_per_unit = 0!!!\n"); - return 1; + dprintf("imsm: no migration in progress.\n"); + return 2; } super->migr_rec->curr_migr_unit = @@ -8841,7 +8843,9 @@ static int imsm_manage_reshape( sra->reshape_progress = next_step; - if (save_checkpoint_imsm(st, sra, UNIT_SRC_NORMAL)) { + if (save_checkpoint_imsm(st, sra, UNIT_SRC_NORMAL) == 1) { + /* ignore error == 2, this can mean end of reshape here + */ dprintf("imsm: Cannot write checkpoint to " "migration record (UNIT_SRC_NORMAL)\n"); goto abort;