md/raid10: Do not add spare disk when recovery fails
authorLi Nan <linan122@huawei.com>
Fri, 2 Jun 2023 09:18:38 +0000 (17:18 +0800)
committerSong Liu <song@kernel.org>
Tue, 13 Jun 2023 22:25:43 +0000 (15:25 -0700)
commit8d355a46c1e0cea59be3ea8395409a5e6eeed946
tree787ce85757eda10e9a33542fc655f10a0adde090
parent4d8a5754a694062f349b8bf66856561e3840c7e5
md/raid10: Do not add spare disk when recovery fails

In raid10_sync_request(), if data cannot be read from any disk for
recovery, it will go to 'giveup' and let 'chunks_skipped' + 1. After
multiple 'giveup', when 'chunks_skipped >= geo.raid_disks', it will
return 'max_sector', indicating that the recovery has been completed.
However, the recovery is just aborted and the data remains inconsistent.

Fix it by setting mirror->recovery_disabled, which will prevent the spare
disk from being added to this mirror. The same issue also exists during
resync, it will be fixed afterwards.

Signed-off-by: Li Nan <linan122@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230602091839.743798-2-linan666@huaweicloud.com
drivers/md/raid10.c