From: "H. Peter Anvin" This patch is functionally identical to the md-02-rebuild-needs-yield.patch for RAID-5, and necessary for exactly the same reasons: From: NeilBrown raid5 rebuild takes stripes so agressively that other access cannot get a look-in. With this patch, the rebuild pauses slightly if there is a shortage of stripes to let other processes have a chance. (akpm: this needs to be tested for yield()-starvation) --- drivers/md/raid6main.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletion(-) diff -puN drivers/md/raid6main.c~raid6-rebuild-needs-yield drivers/md/raid6main.c --- 25/drivers/md/raid6main.c~raid6-rebuild-needs-yield 2004-01-19 00:04:07.000000000 -0800 +++ 25-akpm/drivers/md/raid6main.c 2004-01-19 00:04:07.000000000 -0800 @@ -1557,7 +1557,14 @@ static int sync_request (mddev_t *mddev, first_sector = raid6_compute_sector(stripe*data_disks*sectors_per_chunk + chunk_offset, raid_disks, data_disks, &dd_idx, &pd_idx, conf); - sh = get_active_stripe(conf, sector_nr, pd_idx, 0); + sh = get_active_stripe(conf, sector_nr, pd_idx, 1); + if (sh == NULL) { + sh = get_active_stripe(conf, sector_nr, pd_idx, 0); + /* make sure we don't swamp the stripe cache if someone else + * is trying to get access + */ + yield(); + } spin_lock(&sh->lock); set_bit(STRIPE_SYNCING, &sh->state); clear_bit(STRIPE_INSYNC, &sh->state); _