Skip to content

Commit

Permalink
blk-mq: fix hang in bt_get()
Browse files Browse the repository at this point in the history
Avoid that if there are fewer hardware queues than CPU threads that
bt_get() can hang. The symptoms of the hang were as follows:

* All tags allocated for a particular hardware queue.
* (nr_tags) pending commands for that hardware queue.
* No pending commands for the software queues associated with that
  hardware queue.

Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
bvanassche authored and axboe committed Dec 8, 2014
1 parent 6637fad commit b322320
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions block/blk-mq-tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ static int bt_get(struct blk_mq_alloc_data *data,
if (tag != -1)
break;

/*
* We're out of tags on this hardware queue, kick any
* pending IO submits before going to sleep waiting for
* some to complete.
*/
blk_mq_run_hw_queue(hctx, false);

blk_mq_put_ctx(data->ctx);

io_schedule();
Expand Down

0 comments on commit b322320

Please sign in to comment.