mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-13 20:33:15 +00:00
MD: fix invalid stored role for a disk - try2
Commit d595567dc4
(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>
This commit is contained in:
parent
f8f83d8ffe
commit
9e753ba9b9
@ -1774,10 +1774,6 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
|
||||
} else
|
||||
set_bit(In_sync, &rdev->flags);
|
||||
rdev->raid_disk = role;
|
||||
if (role >= mddev->raid_disks) {
|
||||
rdev->saved_raid_disk = -1;
|
||||
rdev->raid_disk = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (sb->devflags & WriteMostly1)
|
||||
|
@ -1734,6 +1734,7 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)
|
||||
*/
|
||||
if (rdev->saved_raid_disk >= 0 &&
|
||||
rdev->saved_raid_disk >= first &&
|
||||
rdev->saved_raid_disk < conf->raid_disks &&
|
||||
conf->mirrors[rdev->saved_raid_disk].rdev == NULL)
|
||||
first = last = rdev->saved_raid_disk;
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user