]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: Set disk slot number
authorMariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Tue, 3 Oct 2017 12:49:49 +0000 (14:49 +0200)
committerJes Sorensen <jsorensen@fb.com>
Tue, 3 Oct 2017 18:27:13 +0000 (14:27 -0400)
If first disk of IMSM RAID1 is failed but still present in the system,
the array is not auto-assembled. Auto-assemble uses raid disk slot from
metadata to index disks. As it's not set, the valid disk is seen as a
replacement disk and its metadata is ignored. The problem is not
observed for other RAID levels as they have more than 2 disks -
replacement disks are only stored under uneven indexes so third disk
metadata is used in such scenario.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Reviewed-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
super-intel.c

index 536cb6134314c99e1874dc1b95b07ea798d60e0d..b561fe20d0f284e06de3ce2f3436ef01d977380f 100644 (file)
@@ -3502,6 +3502,9 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
                        __u32 ord = get_imsm_ord_tbl_ent(dev, j, MAP_0);
                        __u32 idx = ord_to_idx(ord);
 
+                       if (super->disks && super->disks->index == (int)idx)
+                               info->disk.raid_disk = j;
+
                        if (!(ord & IMSM_ORD_REBUILD) &&
                            get_imsm_missing(super, idx)) {
                                missing = 1;