Skip to content

Commit 7cddb05

Browse files
YuKuai-huaweiliu-song-6
authored andcommitted
md/raid10: don't call bio_start_io_acct twice for bio which experienced read error
handle_read_error() will resumit r10_bio by raid10_read_request(), which will call bio_start_io_acct() again, while bio_end_io_acct() will only be called once. Fix the problem by don't account io again from handle_read_error(). Fixes: 528bc2c ("md/raid10: enable io accounting") Suggested-by: Song Liu <song@kernel.org> Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230314012258.2395894-1-yukuai1@huaweicloud.com
1 parent f0ddb83 commit 7cddb05

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/md/raid10.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,8 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
12501250
}
12511251
slot = r10_bio->read_slot;
12521252

1253-
if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
1253+
if (!r10_bio->start_time &&
1254+
blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
12541255
r10_bio->start_time = bio_start_io_acct(bio);
12551256
read_bio = bio_alloc_clone(rdev->bdev, bio, gfp, &mddev->bio_set);
12561257

@@ -1580,6 +1581,7 @@ static void __make_request(struct mddev *mddev, struct bio *bio, int sectors)
15801581
r10_bio->sector = bio->bi_iter.bi_sector;
15811582
r10_bio->state = 0;
15821583
r10_bio->read_slot = -1;
1584+
r10_bio->start_time = 0;
15831585
memset(r10_bio->devs, 0, sizeof(r10_bio->devs[0]) *
15841586
conf->geo.raid_disks);
15851587

0 commit comments

Comments
 (0)