blk-mq: fix filesystem I/O request allocation
authorMing Lei <ming.lei@redhat.com>
Fri, 12 Nov 2021 12:47:15 +0000 (20:47 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 12 Nov 2021 16:31:13 +0000 (09:31 -0700)
commitb637108a4022951dcc71b672bd101ebe24ad26d5
tree5591ded34bae59f95ab5f95e8c6ff7b3b2827281
parentb781d8db580c058ecd54ed7d5dde7f8270b25f5b
blk-mq: fix filesystem I/O request allocation

submit_bio_checks() may update bio->bi_opf, so we have to initialize
blk_mq_alloc_data.cmd_flags with bio->bi_opf after submit_bio_checks()
returns when allocating new request.

In case of using cached request, fallback to allocate new request if
cached rq isn't compatible with the incoming bio, otherwise change
rq->cmd_flags with incoming bio->bi_opf.

Fixes: 900e080752025f00 ("block: move queue enter logic into blk_mq_submit_bio()")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c
block/blk-mq.h