md/raid10: remove rcu protection to access rdev from conf
authorYu Kuai <yukuai3@huawei.com>
Sat, 25 Nov 2023 08:16:01 +0000 (16:16 +0800)
committerSong Liu <song@kernel.org>
Mon, 27 Nov 2023 23:49:04 +0000 (15:49 -0800)
commita448af25becf4b555660b5ba2618c7ed3c4de6da
tree5f9d106ec6d881cdce4536748567194fa5f9914c
parentc891f1fd90e66e584bb1353e1859cef7c9eb36f8
md/raid10: remove rcu protection to access rdev from conf

Because it's safe to accees rdev from conf:
 - If any spinlock is held, because synchronize_rcu() from
   md_kick_rdev_from_array() will prevent 'rdev' to be freed until
   spinlock is released;
 - If 'reconfig_lock' is held, because rdev can't be added or removed from
   array;
 - If there is normal IO inflight, because mddev_suspend() will prevent
   rdev to be added or removed from array;
 - If there is sync IO inflight, because 'MD_RECOVERY_RUNNING' is
   checked in remove_and_add_spares().

And these will cover all the scenarios in raid10.

This patch also cleanup the code to handle the case that replacement
replace rdev while IO is still inflight.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20231125081604.3939938-3-yukuai1@huaweicloud.com
drivers/md/raid10.c