diff options
author | Tomasz Majchrzak <tomasz.majchrzak@intel.com> | 2016-08-23 04:53:57 -0400 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-08-24 13:21:51 -0400 |
commit | 27028626b4b9022dcac23688e09ea43b36e1183c (patch) | |
tree | c1b2e77abf8a34e3b91ac524a215a5492d0ab188 | |
parent | 0f6187dbe542d71ace8ba0908954b0f4f8a30a1e (diff) |
raid10: record correct address of bad block
For failed write request record block address on a device, not block
address in an array.
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Shaohua Li <shli@fb.com>
-rw-r--r-- | drivers/md/raid10.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 1a632a8c8005..4589866257d5 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -2465,20 +2465,21 @@ static int narrow_write_error(struct r10bio *r10_bio, int i) | |||
2465 | 2465 | ||
2466 | while (sect_to_write) { | 2466 | while (sect_to_write) { |
2467 | struct bio *wbio; | 2467 | struct bio *wbio; |
2468 | sector_t wsector; | ||
2468 | if (sectors > sect_to_write) | 2469 | if (sectors > sect_to_write) |
2469 | sectors = sect_to_write; | 2470 | sectors = sect_to_write; |
2470 | /* Write at 'sector' for 'sectors' */ | 2471 | /* Write at 'sector' for 'sectors' */ |
2471 | wbio = bio_clone_mddev(bio, GFP_NOIO, mddev); | 2472 | wbio = bio_clone_mddev(bio, GFP_NOIO, mddev); |
2472 | bio_trim(wbio, sector - bio->bi_iter.bi_sector, sectors); | 2473 | bio_trim(wbio, sector - bio->bi_iter.bi_sector, sectors); |
2473 | wbio->bi_iter.bi_sector = (r10_bio->devs[i].addr+ | 2474 | wsector = r10_bio->devs[i].addr + (sector - r10_bio->sector); |
2474 | choose_data_offset(r10_bio, rdev) + | 2475 | wbio->bi_iter.bi_sector = wsector + |
2475 | (sector - r10_bio->sector)); | 2476 | choose_data_offset(r10_bio, rdev); |
2476 | wbio->bi_bdev = rdev->bdev; | 2477 | wbio->bi_bdev = rdev->bdev; |
2477 | bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); | 2478 | bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); |
2478 | 2479 | ||
2479 | if (submit_bio_wait(wbio) < 0) | 2480 | if (submit_bio_wait(wbio) < 0) |
2480 | /* Failure! */ | 2481 | /* Failure! */ |
2481 | ok = rdev_set_badblocks(rdev, sector, | 2482 | ok = rdev_set_badblocks(rdev, wsector, |
2482 | sectors, 0) | 2483 | sectors, 0) |
2483 | && ok; | 2484 | && ok; |
2484 | 2485 | ||