linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "block: Merge bio before checking ->cached_rq"
@ 2023-04-20 11:20 Ming Lei
  2023-04-20 12:54 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2023-04-20 11:20 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei, Xiao Ni, Yi Zhang

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>
---
 block/blk-mq.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index cf1a39adf9a5..27a628a8ee88 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2880,16 +2880,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 &&
-- 
2.39.2


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

* Re: [PATCH] Revert "block: Merge bio before checking ->cached_rq"
  2023-04-20 11:20 [PATCH] Revert "block: Merge bio before checking ->cached_rq" Ming Lei
@ 2023-04-20 12:54 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2023-04-20 12:54 UTC (permalink / raw)
  To: Ming Lei; +Cc: linux-block, Xiao Ni, Yi Zhang


On Thu, 20 Apr 2023 19:20:18 +0800, Ming Lei wrote:
> 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.
> 
> 
> [...]

Applied, thanks!

[1/1] Revert "block: Merge bio before checking ->cached_rq"
      commit: 81ea1222f2fa5006f4b9759c2fe1ec154109622d

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2023-04-20 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20 11:20 [PATCH] Revert "block: Merge bio before checking ->cached_rq" Ming Lei
2023-04-20 12:54 ` Jens Axboe

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).