On Fri, Feb 02 2018, yuyufen@xxxxxxxxxx wrote: >> I had forgotten about this patch and will resend. However I think the >> only change needs is adding some comments. I still think the code is >> correct. > (1) When raid10 create, there are 4 disks in raid and 2 spare disks > (sda5, sdd5) > > [ 100.473118] RAID10 conf printout: > [ 100.473121] --- wd:3 rd:4 > [ 100.473123] disk 0, wo:0, o:1, dev:sdb5 > [ 100.473124] disk 1, wo:1, o:0, dev:sdc5 > [ 100.473126] disk 2, wo:0, o:1, dev:sde5 > [ 100.473127] disk 3, wo:0, o:1, dev:sdf5 > > (2) mdadm: hot removed /dev/sdc5 from /dev/md5 > [ 100.473118] RAID10 conf printout: > [ 110.390027] --- wd:3 rd:4 > [ 110.390028] disk 0, wo:0, o:1, dev:sdb5 > [ 110.390029] disk 2, wo:0, o:1, dev:sde5 > [ 110.390030] disk 3, wo:0, o:1, dev:sdf5 > > However, as there are 2 spare disks, we expect raid10 can hot add a disk. > > (3) > mdadm: added /dev/sdc5 > mdadm: hot removed /dev/sdc5 from /dev/md5 > [ 148.680032] RAID10 conf printout: > [ 148.680035] --- wd:2 rd:4 > [ 148.680037] disk 0, wo:0, o:1, dev:sdb5 > [ 148.680038] disk 2, wo:0, o:1, dev:sde5 > > Now, there are 3 spare disks (sda5, sdc5, sdd5) > Also, we expect hot add 2 disk, not just 2 disk in raid10. > > I try to explain, but not sure: > The only place of the runtime to invoke mddev->pers->hot_add_disk(mddev, > rdev) is md_check_recovery(). > But, it will set MD_RECOVERY_RUNNING before invoking > remove_and_add_spares(): This is the piece I was missing. Thanks for pointing that out, definitely a bug in my patch. I'll send a new patch which tests 'this' as well as the flag. Thanks a lot, NeilBrown
Attachment:
signature.asc
Description: PGP signature