Commit e3c5a78c authored by John Garry's avatar John Garry Committed by Jens Axboe

blk-mq: Properly init requests from blk_mq_alloc_request_hctx()

Function blk_mq_alloc_request_hctx() is missing zeroing/init of rq->bio,
biotail, __sector, and __data_len members, which blk_mq_alloc_request()
has, so duplicate what we do in blk_mq_alloc_request().

Fixes: 1f5bd336 ("blk-mq: add blk_mq_alloc_request_hctx")
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/1666780513-121650-1-git-send-email-john.garry@huawei.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent dea31328
...@@ -611,6 +611,7 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, ...@@ -611,6 +611,7 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q,
.nr_tags = 1, .nr_tags = 1,
}; };
u64 alloc_time_ns = 0; u64 alloc_time_ns = 0;
struct request *rq;
unsigned int cpu; unsigned int cpu;
unsigned int tag; unsigned int tag;
int ret; int ret;
...@@ -660,8 +661,12 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, ...@@ -660,8 +661,12 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q,
tag = blk_mq_get_tag(&data); tag = blk_mq_get_tag(&data);
if (tag == BLK_MQ_NO_TAG) if (tag == BLK_MQ_NO_TAG)
goto out_queue_exit; goto out_queue_exit;
return blk_mq_rq_ctx_init(&data, blk_mq_tags_from_data(&data), tag, rq = blk_mq_rq_ctx_init(&data, blk_mq_tags_from_data(&data), tag,
alloc_time_ns); alloc_time_ns);
rq->__data_len = 0;
rq->__sector = (sector_t) -1;
rq->bio = rq->biotail = NULL;
return rq;
out_queue_exit: out_queue_exit:
blk_queue_exit(q); blk_queue_exit(q);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment