Skip to content

Commit bda3153

Browse files
bingjingcshligit
authored andcommitted
md/raid10: fix that replacement cannot complete recovery after reassemble
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>
1 parent bfc9dfd commit bda3153

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/md/raid10.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3893,6 +3893,13 @@ static int raid10_run(struct mddev *mddev)
38933893
disk->rdev->saved_raid_disk < 0)
38943894
conf->fullsync = 1;
38953895
}
3896+
3897+
if (disk->replacement &&
3898+
!test_bit(In_sync, &disk->replacement->flags) &&
3899+
disk->replacement->saved_raid_disk < 0) {
3900+
conf->fullsync = 1;
3901+
}
3902+
38963903
disk->recovery_disabled = mddev->recovery_disabled - 1;
38973904
}
38983905

0 commit comments

Comments
 (0)