summaryrefslogtreecommitdiff
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorBingJing Chang <bingjingc@synology.com>2018-06-28 18:40:11 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-08-24 13:09:08 +0200
commit601c226ea6623b8fb15e33fab3608755929de4da (patch)
treea337dc21641d8a1ab17c4e6f8106c2ed743c8cf5 /drivers/md/raid10.c
parent94cac10c50c1e38a0c51be0fded73e5aa6fa9080 (diff)
md/raid10: fix that replacement cannot complete recovery after reassemble
[ Upstream commit bda3153998f3eb2cafa4a6311971143628eacdbc ] During assemble, the spare marked for replacement is not checked. conf->fullsync cannot be updated to be 1. As a result, recovery will treat it as a clean array. All recovering sectors are skipped. Original device is replaced with the not-recovered spare. mdadm -C /dev/md0 -l10 -n4 -pn2 /dev/loop[0123] mdadm /dev/md0 -a /dev/loop4 mdadm /dev/md0 --replace /dev/loop0 mdadm -S /dev/md0 # stop array during recovery mdadm -A /dev/md0 /dev/loop[01234] After reassemble, you can see recovery go on, but it completes immediately. In fact, recovery is not actually processed. To solve this problem, we just add the missing logics for replacment spares. (In raid1.c or raid5.c, they have already been checked.) Reported-by: Alex Chen <alexchen@synology.com> Reviewed-by: Alex Wu <alexwu@synology.com> Reviewed-by: Chung-Chiang Cheng <cccheng@synology.com> Signed-off-by: BingJing Chang <bingjingc@synology.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r--drivers/md/raid10.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index b20c23f970f4..262a0f0f8fd5 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3754,6 +3754,13 @@ static int raid10_run(struct mddev *mddev)
disk->rdev->saved_raid_disk < 0)
conf->fullsync = 1;
}
+
+ if (disk->replacement &&
+ !test_bit(In_sync, &disk->replacement->flags) &&
+ disk->replacement->saved_raid_disk < 0) {
+ conf->fullsync = 1;
+ }
+
disk->recovery_disabled = mddev->recovery_disabled - 1;
}