linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk-mq: Properly init bios from blk_mq_alloc_request_hctx()
@ 2022-10-22 16:07 John Garry
  2022-10-23 13:12 ` Ming Lei
  0 siblings, 1 reply; 14+ messages in thread
From: John Garry @ 2022-10-22 16:07 UTC (permalink / raw)
  To: axboe; +Cc: linux-kernel, linux-block, hch, John Garry

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.

Move init'ing of those members to common blk_mq_rq_ctx_init().

Fixes: 1f5bd336b9150 ("blk-mq: add blk_mq_alloc_request_hctx")
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: John Garry <john.garry@huawei.com>

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 8070b6c10e8d..260adeb2e455 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -402,6 +402,10 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
 		}
 	}
 
+	rq->__data_len = 0;
+	rq->__sector = (sector_t) -1;
+	rq->bio = rq->biotail = NULL;
+
 	return rq;
 }
 
@@ -591,9 +595,6 @@ struct request *blk_mq_alloc_request(struct request_queue *q, blk_opf_t opf,
 		if (!rq)
 			goto out_queue_exit;
 	}
-	rq->__data_len = 0;
-	rq->__sector = (sector_t) -1;
-	rq->bio = rq->biotail = NULL;
 	return rq;
 out_queue_exit:
 	blk_queue_exit(q);
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-10-25 12:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22 16:07 [PATCH] blk-mq: Properly init bios from blk_mq_alloc_request_hctx() John Garry
2022-10-23 13:12 ` Ming Lei
2022-10-24 10:56   ` John Garry
2022-10-24 13:27     ` Ming Lei
2022-10-24 16:56       ` John Garry
2022-10-25  0:34         ` Ming Lei
2022-10-25  7:40           ` John Garry
2022-10-25  9:00             ` Ming Lei
2022-10-25  9:08               ` John Garry
2022-10-25  9:16                 ` Ming Lei
2022-10-25  9:32                   ` John Garry
2022-10-25 11:21                     ` Ming Lei
2022-10-25 11:36                       ` John Garry
2022-10-25 12:33                         ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).