summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2018-10-14 17:05:07 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-13 11:09:00 -0800
commit589c375032fc7e0d90ba554f2f16414401034eb3 (patch)
treea67a18b7e9d389b85fb42676968b47222585b6b1 /drivers/md/raid10.c
parentfcd90d7dea56f968cc540ba5b500700449799be8 (diff)
downloadlinux-stable-589c375032fc7e0d90ba554f2f16414401034eb3.tar.gz
linux-stable-589c375032fc7e0d90ba554f2f16414401034eb3.tar.bz2
linux-stable-589c375032fc7e0d90ba554f2f16414401034eb3.zip
MD: fix invalid stored role for a disk - try2
commit 9e753ba9b9b405e3902d9f08aec5f2ea58a0c317 upstream. Commit d595567dc4f0 (MD: fix invalid stored role for a disk) broke linear hotadd. Let's only fix the role for disks in raid1/10. Based on Guoqing's original patch. Reported-by: kernel test robot <rong.a.chen@intel.com> Cc: Gioh Kim <gi-oh.kim@profitbricks.com> Cc: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r--drivers/md/raid10.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index d6f7978b4449..811427e53126 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1808,6 +1808,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev)
first = last = rdev->raid_disk;
if (rdev->saved_raid_disk >= first &&
+ rdev->saved_raid_disk < conf->geo.raid_disks &&
conf->mirrors[rdev->saved_raid_disk].rdev == NULL)
mirror = rdev->saved_raid_disk;
else