Commit 5f480b1a authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe

blk-mq: use bio->bi_opf after bio is checked

bio->bi_opf isn't finalized before checking the bio, so use it after
submit_bio_checks() returns.

Fixes: 5b13bc8a ("blk-mq: cleanup request allocation")
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent c65e6fd4
...@@ -2713,7 +2713,6 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q, ...@@ -2713,7 +2713,6 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
struct blk_mq_alloc_data data = { struct blk_mq_alloc_data data = {
.q = q, .q = q,
.nr_tags = 1, .nr_tags = 1,
.cmd_flags = bio->bi_opf,
}; };
struct request *rq; struct request *rq;
...@@ -2726,6 +2725,8 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q, ...@@ -2726,6 +2725,8 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
rq_qos_throttle(q, bio); rq_qos_throttle(q, bio);
/* ->bi_opf is finalized after submit_bio_checks() returns */
data.cmd_flags = bio->bi_opf;
if (plug) { if (plug) {
data.nr_tags = plug->nr_ios; data.nr_tags = plug->nr_ios;
plug->nr_ios = 1; plug->nr_ios = 1;
......
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