Re: [PATCH v2 3/3] md/raid10: skip clean regions in bulk during recovery
Yunye Zhao <[email protected]> Tue, 4 Aug 2026 11:55:16 +0800
| Newsgroups | org.kernel.vger.linux-raid,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Hi Kuai,
On Thu, 31 Jul 2026 at 17:46, Yu Kuai wrote:
> I'm confused, recovery means replace a new disk ... the whole new disk
> have to rebuild ... there is nothing to skip
>
> So are you talking about the case that the array is already broken?
The recovery target here is a *re-added existing member*, not a fresh
spare.
Right, for a fresh spare: saved_raid_disk != slot sets conf->fullsync=1,
this skip is bypassed, and the whole disk rebuilds. This patch does not
touch that.
The case I fix is a member transiently removed and re-added:
- a member drops out; its mirror partner stays online, so the array is
still redundant and readable (not broken);
- nothing is written while it is gone, so the write-intent bitmap
stays clean;
- the same disk is re-added: valid superblock, saved_raid_disk == old
slot, so conf->fullsync stays 0 and md does a bitmap-based recovery
(MD_RECOVERY_RECOVER; /proc/mdstat shows "recovery").
The bitmap is fully clean, every chunk returns must_sync == false,
biolist stays NULL, and we hit the existing "*skipped=1; return
max_sync;" path. Only its step size is wrong.
Reproducer (near=2, 4 disks, nothing written while degraded, each pair
keeps a live copy):
mdadm --create /dev/md0 -l10 -n4 -p n2 --bitmap=internal \
--bitmap-chunk=512M --assume-clean --run <4 x 8T>
mdadm /dev/md0 --fail /dev/loop1 --remove /dev/loop1
mdadm /dev/md0 --fail /dev/loop3 --remove /dev/loop3
# no writes here
mdadm /dev/md0 --re-add /dev/loop1
mdadm /dev/md0 --re-add /dev/loop3
Thanks,
Yunye