mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 07:00:48 +00:00
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>
This commit is contained in:
parent
af03b8e4e8
commit
ed45666271
@ -1240,17 +1240,24 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
|
|||||||
}
|
}
|
||||||
r1_bio->read_disk = primary;
|
r1_bio->read_disk = primary;
|
||||||
for (i=0; i<mddev->raid_disks; i++)
|
for (i=0; i<mddev->raid_disks; i++)
|
||||||
if (r1_bio->bios[i]->bi_end_io == end_sync_read &&
|
if (r1_bio->bios[i]->bi_end_io == end_sync_read) {
|
||||||
test_bit(BIO_UPTODATE, &r1_bio->bios[i]->bi_flags)) {
|
|
||||||
int j;
|
int j;
|
||||||
int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9);
|
int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9);
|
||||||
struct bio *pbio = r1_bio->bios[primary];
|
struct bio *pbio = r1_bio->bios[primary];
|
||||||
struct bio *sbio = r1_bio->bios[i];
|
struct bio *sbio = r1_bio->bios[i];
|
||||||
for (j = vcnt; j-- ; )
|
|
||||||
if (memcmp(page_address(pbio->bi_io_vec[j].bv_page),
|
if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) {
|
||||||
page_address(sbio->bi_io_vec[j].bv_page),
|
for (j = vcnt; j-- ; ) {
|
||||||
PAGE_SIZE))
|
struct page *p, *s;
|
||||||
break;
|
p = pbio->bi_io_vec[j].bv_page;
|
||||||
|
s = sbio->bi_io_vec[j].bv_page;
|
||||||
|
if (memcmp(page_address(p),
|
||||||
|
page_address(s),
|
||||||
|
PAGE_SIZE))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
j = 0;
|
||||||
if (j >= 0)
|
if (j >= 0)
|
||||||
mddev->resync_mismatches += r1_bio->sectors;
|
mddev->resync_mismatches += r1_bio->sectors;
|
||||||
if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
|
if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user