diff options
author | Mike Accetta <maccetta@laurelnetworks.com> | 2007-06-16 13:16:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-16 16:16:15 -0400 |
commit | ed45666271f4fafa95b9d8ad44050e9a9bd2376e (patch) | |
tree | 6f626a05e7d78029252768c2ac5f9b1d5309319b /drivers/md/raid1.c | |
parent | af03b8e4e81c3789e597632268940edd11ffe870 (diff) |
md: fix bug in error handling during raid1 repair
If raid1/repair (which reads all block and fixes any differences it finds)
hits a read error, it doesn't reset the bio for writing before writing
correct data back, so the read error isn't fixed, and the device probably
gets a zero-length write which it might complain about.
Signed-off-by: Neil Brown <neilb@suse.de>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 3a95cc5e029c..46677d7d9980 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1240,17 +1240,24 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
1240 | } | 1240 | } |
1241 | r1_bio->read_disk = primary; | 1241 | r1_bio->read_disk = primary; |
1242 | for (i=0; i<mddev->raid_disks; i++) | 1242 | for (i=0; i<mddev->raid_disks; i++) |
1243 | if (r1_bio->bios[i]->bi_end_io == end_sync_read && | 1243 | if (r1_bio->bios[i]->bi_end_io == end_sync_read) { |
1244 | test_bit(BIO_UPTODATE, &r1_bio->bios[i]->bi_flags)) { | ||
1245 | int j; | 1244 | int j; |
1246 | int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9); | 1245 | int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9); |
1247 | struct bio *pbio = r1_bio->bios[primary]; | 1246 | struct bio *pbio = r1_bio->bios[primary]; |
1248 | struct bio *sbio = r1_bio->bios[i]; | 1247 | struct bio *sbio = r1_bio->bios[i]; |
1249 | for (j = vcnt; j-- ; ) | 1248 | |
1250 | if (memcmp(page_address(pbio->bi_io_vec[j].bv_page), | 1249 | if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) { |
1251 | page_address(sbio->bi_io_vec[j].bv_page), | 1250 | for (j = vcnt; j-- ; ) { |
1252 | PAGE_SIZE)) | 1251 | struct page *p, *s; |
1253 | break; | 1252 | p = pbio->bi_io_vec[j].bv_page; |
1253 | s = sbio->bi_io_vec[j].bv_page; | ||
1254 | if (memcmp(page_address(p), | ||
1255 | page_address(s), | ||
1256 | PAGE_SIZE)) | ||
1257 | break; | ||
1258 | } | ||
1259 | } else | ||
1260 | j = 0; | ||
1254 | if (j >= 0) | 1261 | if (j >= 0) |
1255 | mddev->resync_mismatches += r1_bio->sectors; | 1262 | mddev->resync_mismatches += r1_bio->sectors; |
1256 | if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) { | 1263 | if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) { |