diff options
author | NeilBrown <neilb@suse.de> | 2009-05-06 22:48:10 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-05-06 22:48:10 -0400 |
commit | 18055569127253755d01733f6ecc004ed02f88d0 (patch) | |
tree | 5f1fa83f98d8a6d08cd1916106a2c5b9f9f6ec43 /drivers | |
parent | b74fd2826c5acce20e6f691437b2d19372bc2057 (diff) |
md/raid10: don't clear bitmap during recovery if array will still be degraded.
If we have a raid10 with multiple missing devices, and we recover just
one of these to a spare, then we risk (depending on the bitmap and
array chunk size) clearing bits of the bitmap for which recovery isn't
complete (because a device is still missing).
This can lead to a subsequent "re-add" being recovered without
any IO happening, which would result in loss of data.
This patch takes the safe approach of not clearing bitmap bits
if the array will still be degraded.
This patch is suitable for all active -stable kernels.
Cc: stable@kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/raid10.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 81a54f17417e..499620afb44b 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1809,17 +1809,17 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1809 | r10_bio->sector = sect; | 1809 | r10_bio->sector = sect; |
1810 | 1810 | ||
1811 | raid10_find_phys(conf, r10_bio); | 1811 | raid10_find_phys(conf, r10_bio); |
1812 | /* Need to check if this section will still be | 1812 | |
1813 | /* Need to check if the array will still be | ||
1813 | * degraded | 1814 | * degraded |
1814 | */ | 1815 | */ |
1815 | for (j=0; j<conf->copies;j++) { | 1816 | for (j=0; j<conf->raid_disks; j++) |
1816 | int d = r10_bio->devs[j].devnum; | 1817 | if (conf->mirrors[j].rdev == NULL || |
1817 | if (conf->mirrors[d].rdev == NULL || | 1818 | test_bit(Faulty, &conf->mirrors[j].rdev->flags)) { |
1818 | test_bit(Faulty, &conf->mirrors[d].rdev->flags)) { | ||
1819 | still_degraded = 1; | 1819 | still_degraded = 1; |
1820 | break; | 1820 | break; |
1821 | } | 1821 | } |
1822 | } | 1822 | |
1823 | must_sync = bitmap_start_sync(mddev->bitmap, sect, | 1823 | must_sync = bitmap_start_sync(mddev->bitmap, sect, |
1824 | &sync_blocks, still_degraded); | 1824 | &sync_blocks, still_degraded); |
1825 | 1825 | ||