diff options
author | Ming Lei <ming.lei@redhat.com> | 2023-04-20 19:20:18 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-04-20 06:54:17 -0600 |
commit | 81ea1222f2fa5006f4b9759c2fe1ec154109622d (patch) | |
tree | 3e62a64a9df6d8d8a1ca898e8596c21f3a99cd82 /block | |
parent | f7ca1ae32bd89ab035568c63b4443eb55420b423 (diff) | |
download | lwn-81ea1222f2fa5006f4b9759c2fe1ec154109622d.tar.gz lwn-81ea1222f2fa5006f4b9759c2fe1ec154109622d.zip |
Revert "block: Merge bio before checking ->cached_rq"
This reverts commit 23f3e3272e7a4d9fb870485cd6df1e4f9539282c.
blk-mq sched bio merge still needs request to grab queue usage counter,
so we can't simply call blk_mq_attempt_bio_merge() when queue usage
counter isn't held.
Fixes: 23f3e3272e7a ("block: Merge bio before checking ->cached_rq")
Cc: Xiao Ni <xni@redhat.com>
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20230420112018.1108058-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-mq.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index f0ea9dcfb966..2831f78f86a0 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2878,16 +2878,15 @@ static inline struct request *blk_mq_get_cached_request(struct request_queue *q, if (!plug) return NULL; + rq = rq_list_peek(&plug->cached_rq); + if (!rq || rq->q != q) + return NULL; if (blk_mq_attempt_bio_merge(q, *bio, nsegs)) { *bio = NULL; return NULL; } - rq = rq_list_peek(&plug->cached_rq); - if (!rq || rq->q != q) - return NULL; - type = blk_mq_get_hctx_type((*bio)->bi_opf); hctx_type = rq->mq_hctx->type; if (type != hctx_type && |