Skip to content

Commit 592ee11

Browse files
YuKuai-huaweiaxboe
authored andcommitted
blk-mq: fix missing blk_account_io_done() in error path
If blk_mq_request_issue_directly() failed from blk_insert_cloned_request(), the request will be accounted start. Currently, blk_insert_cloned_request() is only called by dm, and such request won't be accounted done by dm. In normal path, io will be accounted start from blk_mq_bio_to_request(), when the request is allocated, and such io will be accounted done from __blk_mq_end_request_acct() whether it succeeded or failed. Thus add blk_account_io_done() to fix the problem. Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 83114df commit 592ee11

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

block/blk-mq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2922,6 +2922,8 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *
29222922
*/
29232923
blk_mq_run_dispatch_ops(rq->q,
29242924
ret = blk_mq_request_issue_directly(rq, true));
2925+
if (ret)
2926+
blk_account_io_done(rq, ktime_get_ns());
29252927
return ret;
29262928
}
29272929
EXPORT_SYMBOL_GPL(blk_insert_cloned_request);

0 commit comments

Comments
 (0)