[PATCH] IMSM: Clear migration record on disks more often

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

 



Migration record is not always cleared after successful migration. This can
block another reshape from being started. Migration will not be continued via
systemd service due to error in verifying reshape position. This patch added
clearing migration record when disk is added to container, and after successful
migration.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@xxxxxxxxx>
---
 super-intel.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/super-intel.c b/super-intel.c
index 4c53019..2406991 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -5055,6 +5055,14 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,
 	}
 
 	get_dev_size(fd, NULL, &size);
+	/* clear migr_rec when adding disk to container */
+	memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SIZE);
+	if (lseek64(fd, size - 512, SEEK_SET) >= 0) {
+		if (write(fd, super->migr_rec_buf,
+			MIGR_REC_BUF_SIZE) != MIGR_REC_BUF_SIZE)
+			perror("Write migr_rec failed");
+	}
+
 	size /= 512;
 	serialcpy(dd->disk.serial, dd->serial);
 	set_total_blocks(&dd->disk, size);
@@ -10648,6 +10656,23 @@ static int imsm_manage_reshape(
 
 	}
 
+	/* clear migr_rec on disks after successful migration */
+	struct dl *d;
+
+	memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SIZE);
+	for (d = super->disks; d; d = d->next) {
+		if (d->index < 0 || is_failed(&d->disk))
+			continue;
+		unsigned long long dsize;
+
+		get_dev_size(d->fd, NULL, &dsize);
+		if (lseek64(d->fd, dsize - 512, SEEK_SET) >= 0) {
+			if (write(d->fd, super->migr_rec_buf,
+				MIGR_REC_BUF_SIZE) != MIGR_REC_BUF_SIZE)
+				perror("Write migr_rec failed");
+		}
+	}
+
 	/* return '1' if done */
 	ret_val = 1;
 abort:

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