Re: [PATCH AUTOSEL 4.19 118/146] MD: fix invalid stored role for a disk

From: Sasha Levin
Date: Tue Nov 06 2018 - 10:50:17 EST


On Tue, Nov 06, 2018 at 08:37:32AM +0100, Jack Wang wrote:
Sasha Levin <sashal@xxxxxxxxxx> ä2018å11æ1æåå äå12:45åéï

From: Shaohua Li <shli@xxxxxx>

[ Upstream commit d595567dc4f0c1d90685ec1e2e296e2cad2643ac ]

If we change the number of array's device after device is removed from array,
then add the device back to array, we can see that device is added as active
role instead of spare which we expected.

Please see the below link for details:
https://marc.info/?l=linux-raid&m=153736982015076&w=2

This is caused by that we prefer to use device's previous role which is
recorded by saved_raid_disk, but we should respect the new number of
conf->raid_disks since it could be changed after device is removed.

Reported-by: Gioh Kim <gi-oh.kim@xxxxxxxxxxxxxxxx>
Tested-by: Gioh Kim <gi-oh.kim@xxxxxxxxxxxxxxxx>
Acked-by: Guoqing Jiang <gqjiang@xxxxxxxx>9e753ba9b9b405e3902d9f08aec5f2ea58a0c317
Signed-off-by: Shaohua Li <shli@xxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
Hi Sasha,

This patch breaks linear hotadd please also include commit
9e753ba9b9b405e3902d9f08aec5f2ea58a0c317
MD: fix invalid stored role for a disk - try2

I'll queue it up, thanks Jack!

--
Thanks,
Sasha