File 0187-imsm-use-correct-map-when-validating-ppl.patch of Package mdadm.7989

From 2fc0fc63a9dbf31a3e333492bc1df80c21fdb10c Mon Sep 17 00:00:00 2001
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Date: Thu, 28 Sep 2017 14:41:17 +0200
Subject: [PATCH] imsm: use correct map when validating ppl
Git-commit: 2fc0fc63a9dbf31a3e333492bc1df80c21fdb10c
Patch-mainline: mdadm-4.0+
References: bsc#1069165, bsc#1069167, bsc#1068030

Use the first map to get the correct disk when rebuilding and not the
failed disk from the second map.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Signed-off-by: Coly Li <colyli@suse.de>

---
 super-intel.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 996d133..cf5d822 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -6119,7 +6119,6 @@ static int validate_ppl_imsm(struct supertype *st, struct mdinfo *info,
 	struct ppl_header *ppl_hdr;
 	__u32 crc;
 	struct imsm_dev *dev;
-	struct imsm_map *map;
 	__u32 idx;
 	unsigned int i;
 	unsigned long long ppl_offset = 0;
@@ -6134,8 +6133,7 @@ static int validate_ppl_imsm(struct supertype *st, struct mdinfo *info,
 	}
 
 	dev = get_imsm_dev(super, info->container_member);
-	map = get_imsm_map(dev, MAP_X);
-	idx = get_imsm_disk_idx(dev, disk->disk.raid_disk, MAP_X);
+	idx = get_imsm_disk_idx(dev, disk->disk.raid_disk, MAP_0);
 	d = get_imsm_dl_disk(super, idx);
 
 	if (!d || d->index < 0 || is_failed(&d->disk))
@@ -6225,6 +6223,8 @@ out:
 	}
 
 	if (ret == 1) {
+		struct imsm_map *map = get_imsm_map(dev, MAP_X);
+
 		if (map->map_state == IMSM_T_STATE_UNINITIALIZED ||
 		   (map->map_state == IMSM_T_STATE_NORMAL &&
 		   !(dev->vol.dirty & RAIDVOL_DIRTY)))
-- 
2.13.6
openSUSE Build Service is sponsored by