[PATCH] md: fix problem with raid6 intent bitmap

When doing a recovery, we need to know whether the array will still be
degraded after the recovery has finished, so we can know whether bits can be
clearred yet or not. This patch performs the required check.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

NeilBrown and committed by
Linus Torvalds
b5ab28a3 700e432d

+13 -2
+13 -2
drivers/md/raid6main.c
··· 1702 1702 int data_disks = raid_disks - 2; 1703 1703 sector_t max_sector = mddev->size << 1; 1704 1704 int sync_blocks; 1705 + int still_degraded = 0; 1706 + int i; 1705 1707 1706 1708 if (sector_nr >= max_sector) { 1707 1709 /* just being told to finish up .. nothing much to do */ ··· 1712 1710 if (mddev->curr_resync < max_sector) /* aborted */ 1713 1711 bitmap_end_sync(mddev->bitmap, mddev->curr_resync, 1714 1712 &sync_blocks, 1); 1715 - else /* compelted sync */ 1713 + else /* completed sync */ 1716 1714 conf->fullsync = 0; 1717 1715 bitmap_close_sync(mddev->bitmap); 1718 1716 ··· 1750 1748 */ 1751 1749 schedule_timeout_uninterruptible(1); 1752 1750 } 1753 - bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 0); 1751 + /* Need to check if array will still be degraded after recovery/resync 1752 + * We don't need to check the 'failed' flag as when that gets set, 1753 + * recovery aborts. 1754 + */ 1755 + for (i=0; i<mddev->raid_disks; i++) 1756 + if (conf->disks[i].rdev == NULL) 1757 + still_degraded = 1; 1758 + 1759 + bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, still_degraded); 1760 + 1754 1761 spin_lock(&sh->lock); 1755 1762 set_bit(STRIPE_SYNCING, &sh->state); 1756 1763 clear_bit(STRIPE_INSYNC, &sh->state);