From: John Garry <john.garry@huawei.com>
To: <axboe@kernel.dk>
Cc: <linux-kernel@vger.kernel.org>, <linux-block@vger.kernel.org>,
<hch@lst.de>, John Garry <john.garry@huawei.com>
Subject: [PATCH] blk-mq: Properly init bios from blk_mq_alloc_request_hctx()
Date: Sun, 23 Oct 2022 00:07:26 +0800 [thread overview]
Message-ID: <1666454846-11749-1-git-send-email-john.garry@huawei.com> (raw)
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
next reply other threads:[~2022-10-22 15:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-22 16:07 John Garry [this message]
2022-10-23 13:12 ` [PATCH] blk-mq: Properly init bios from blk_mq_alloc_request_hctx() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1666454846-11749-1-git-send-email-john.garry@huawei.com \
--to=john.garry@huawei.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox