summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Majchrzak <tomasz.majchrzak@intel.com>2016-10-24 12:00:17 +0200
committerJes Sorensen <Jes.Sorensen@redhat.com>2016-10-26 12:00:46 -0400
commit12fe93e9133aefce2f18a622e1910fac3f774923 (patch)
tree48e22069e4977b548caa44b0bf78f8dc4c9996bc
parente9eb82adb811af0d07d4d4675151e9a97b2724b9 (diff)
downloadmdadm-12fe93e9133aefce2f18a622e1910fac3f774923.tar.gz
imsm: load migration record from right disk
Migration record is only stored on disks in first and second metadata slot. The function to load the record incorrectly passes disk slot as disk index. If rebuilt has taken place for a container, disk slot doesn't match disk index so it causes migration record to be read from a disk it has not been written to. As a result reshape operation fails. Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
-rw-r--r--super-intel.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/super-intel.c b/super-intel.c
index f52e3d4..e501b6f 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -2477,19 +2477,12 @@ static int load_imsm_migr_rec(struct intel_super *super, struct mdinfo *info)
*/
if (dev == NULL)
return -2;
- map = get_imsm_map(dev, MAP_0);
if (info) {
for (sd = info->devs ; sd ; sd = sd->next) {
- /* skip spare and failed disks
- */
- if (sd->disk.raid_disk < 0)
- continue;
/* read only from one of the first two slots */
- if (map)
- slot = get_imsm_disk_slot(map,
- sd->disk.raid_disk);
- if (map == NULL || slot > 1 || slot < 0)
+ if ((sd->disk.raid_disk < 0) ||
+ (sd->disk.raid_disk > 1))
continue;
sprintf(nm, "%d:%d", sd->disk.major, sd->disk.minor);
@@ -2499,6 +2492,7 @@ static int load_imsm_migr_rec(struct intel_super *super, struct mdinfo *info)
}
}
if (fd < 0) {
+ map = get_imsm_map(dev, MAP_0);
for (dl = super->disks; dl; dl = dl->next) {
/* skip spare and failed disks
*/