aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-07-30 20:05:34 -0400
committerNeilBrown <neilb@suse.de>2012-07-30 20:05:34 -0400
commitb7219ccb33aa0df9949a60c68b5e9f712615e56f (patch)
tree64f89f9a0270134c1895ddfe230bc6e862213ab0 /drivers
parent90cf195d9bcb4bf70e8b6df5073b05164b279ba0 (diff)
md/raid1: don't abort a resync on the first badblock.
If a resync of a RAID1 array with 2 devices finds a known bad block one device it will neither read from, or write to, that device for this block offset. So there will be one read_target (The other device) and zero write targets. This condition causes md/raid1 to abort the resync assuming that it has finished - without known bad blocks this would be true. When there are no write targets because of the presence of bad blocks we should only skip over the area covered by the bad block. RAID10 already gets this right, raid1 doesn't. Or didn't. As this can cause a 'sync' to abort early and appear to have succeeded it could lead to some data corruption, so it suitable for -stable. Cc: stable@vger.kernel.org Reported-by: Alexander Lyakas <alex.bolshoy@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/raid1.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 7aa958ed2847..d2361b162de5 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2502,7 +2502,10 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
2502 /* There is nowhere to write, so all non-sync 2502 /* There is nowhere to write, so all non-sync
2503 * drives must be failed - so we are finished 2503 * drives must be failed - so we are finished
2504 */ 2504 */
2505 sector_t rv = max_sector - sector_nr; 2505 sector_t rv;
2506 if (min_bad > 0)
2507 max_sector = sector_nr + min_bad;
2508 rv = max_sector - sector_nr;
2506 *skipped = 1; 2509 *skipped = 1;
2507 put_buf(r1_bio); 2510 put_buf(r1_bio);
2508 return rv; 2511 return rv;