Skip to content

Commit

Permalink
blk-mq: don't grab ->q_usage_counter in blk_mq_sched_bio_merge
Browse files Browse the repository at this point in the history
blk_mq_sched_bio_merge is only called from blk-mq.c:blk_attempt_bio_merge(),
which is called when queue usage counter is grabbed already:

1) blk_mq_get_new_requests()

2) blk_mq_get_request()
- cached request in current plug owns one queue usage counter

So don't grab ->q_usage_counter in blk_mq_sched_bio_merge(), and more
importantly this nest way causes hang in blk_mq_freeze_queue_wait().

Cc: Christoph Hellwig <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Ming Lei authored and axboe committed Nov 11, 2021
1 parent 438cd74 commit 10f7335
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions block/blk-mq-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,6 @@ bool blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio,
bool ret = false;
enum hctx_type type;

if (bio_queue_enter(bio))
return false;

if (e && e->type->ops.bio_merge) {
ret = e->type->ops.bio_merge(q, bio, nr_segs);
goto out_put;
Expand All @@ -397,7 +394,6 @@ bool blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio,

spin_unlock(&ctx->lock);
out_put:
blk_queue_exit(q);
return ret;
}

Expand Down

0 comments on commit 10f7335

Please sign in to comment.