Re: [PATCH v2 3/3] md/raid10: skip clean regions in bulk during recovery
"yu kuai" <[email protected]>
| Newsgroups | org.kernel.vger.linux-raid,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Hi, 在 2026/8/4 11:55, Yunye Zhao 写道: > 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. By re-add a disk, this is really a resync, and bitmap can be used in this case to skip clean bits. In this case, I still think the correct solution, for old bitmap, is to let bitmap_start_sync() return much bigger skipped blocks. > > 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. This is not re-add and it's a real recovery. > > 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 -- Thanks, Kuai