|
|
33ef8b |
From 71e5411eeaf7e97a67dfed20ea8c365e28c7481c Mon Sep 17 00:00:00 2001
|
|
|
33ef8b |
From: Pawel Baldysiak <pawel.baldysiak@intel.com>
|
|
|
33ef8b |
Date: Tue, 20 Jan 2015 13:52:25 +0100
|
|
|
33ef8b |
Subject: [PATCH] IMSM: Clear migration record on disks more often
|
|
|
33ef8b |
|
|
|
33ef8b |
Migration record is not always cleared after successful migration. This can
|
|
|
33ef8b |
block another reshape from being started. Migration will not be continued via
|
|
|
33ef8b |
systemd service due to error in verifying reshape position. This patch added
|
|
|
33ef8b |
clearing migration record when disk is added to container, and after successful
|
|
|
33ef8b |
migration.
|
|
|
33ef8b |
|
|
|
33ef8b |
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
|
|
|
33ef8b |
Signed-off-by: NeilBrown <neilb@suse.de>
|
|
|
33ef8b |
---
|
|
|
33ef8b |
super-intel.c | 26 ++++++++++++++++++++++++++
|
|
|
33ef8b |
1 file changed, 26 insertions(+)
|
|
|
33ef8b |
|
|
|
33ef8b |
diff --git a/super-intel.c b/super-intel.c
|
|
|
33ef8b |
index 4c53019..4b23b9a 100644
|
|
|
33ef8b |
--- a/super-intel.c
|
|
|
33ef8b |
+++ b/super-intel.c
|
|
|
33ef8b |
@@ -5055,6 +5055,14 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,
|
|
|
33ef8b |
}
|
|
|
33ef8b |
|
|
|
33ef8b |
get_dev_size(fd, NULL, &size);
|
|
|
33ef8b |
+ /* clear migr_rec when adding disk to container */
|
|
|
33ef8b |
+ memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SIZE);
|
|
|
33ef8b |
+ if (lseek64(fd, size - MIGR_REC_POSITION, SEEK_SET) >= 0) {
|
|
|
33ef8b |
+ if (write(fd, super->migr_rec_buf,
|
|
|
33ef8b |
+ MIGR_REC_BUF_SIZE) != MIGR_REC_BUF_SIZE)
|
|
|
33ef8b |
+ perror("Write migr_rec failed");
|
|
|
33ef8b |
+ }
|
|
|
33ef8b |
+
|
|
|
33ef8b |
size /= 512;
|
|
|
33ef8b |
serialcpy(dd->disk.serial, dd->serial);
|
|
|
33ef8b |
set_total_blocks(&dd->disk, size);
|
|
|
33ef8b |
@@ -10648,6 +10656,24 @@ static int imsm_manage_reshape(
|
|
|
33ef8b |
|
|
|
33ef8b |
}
|
|
|
33ef8b |
|
|
|
33ef8b |
+ /* clear migr_rec on disks after successful migration */
|
|
|
33ef8b |
+ struct dl *d;
|
|
|
33ef8b |
+
|
|
|
33ef8b |
+ memset(super->migr_rec_buf, 0, MIGR_REC_BUF_SIZE);
|
|
|
33ef8b |
+ for (d = super->disks; d; d = d->next) {
|
|
|
33ef8b |
+ if (d->index < 0 || is_failed(&d->disk))
|
|
|
33ef8b |
+ continue;
|
|
|
33ef8b |
+ unsigned long long dsize;
|
|
|
33ef8b |
+
|
|
|
33ef8b |
+ get_dev_size(d->fd, NULL, &dsize);
|
|
|
33ef8b |
+ if (lseek64(d->fd, dsize - MIGR_REC_POSITION,
|
|
|
33ef8b |
+ SEEK_SET) >= 0) {
|
|
|
33ef8b |
+ if (write(d->fd, super->migr_rec_buf,
|
|
|
33ef8b |
+ MIGR_REC_BUF_SIZE) != MIGR_REC_BUF_SIZE)
|
|
|
33ef8b |
+ perror("Write migr_rec failed");
|
|
|
33ef8b |
+ }
|
|
|
33ef8b |
+ }
|
|
|
33ef8b |
+
|
|
|
33ef8b |
/* return '1' if done */
|
|
|
33ef8b |
ret_val = 1;
|
|
|
33ef8b |
abort:
|
|
|
33ef8b |
--
|
|
|
33ef8b |
2.1.0
|
|
|
33ef8b |
|