From 82b15ff40d71aed318f9946881825f9f03ef8f48 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 24 Jan 2017 14:43:09 +0100 Subject: [PATCH] block-mq: fixup queue stall __blk_mq_alloc_request() calls blk_mq_tag_busy(), which might result in the queue to become blocked. So we need to call blk_mq_tag_idle() once the tag is finished to wakeup all waiters on the queue. Patch is relative to the blk-mq-sched branch Signed-off-by: Hannes Reinecke --- block/blk-mq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 739a292..d52bcb1 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -333,10 +333,12 @@ void __blk_mq_finish_request(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, { const int sched_tag = rq->internal_tag; struct request_queue *q = rq->q; + bool unbusy = false; - if (rq->rq_flags & RQF_MQ_INFLIGHT) + if (rq->rq_flags & RQF_MQ_INFLIGHT) { atomic_dec(&hctx->nr_active); - + unbusy = true; + } wbt_done(q->rq_wb, &rq->issue_stat); rq->rq_flags = 0; @@ -346,6 +348,9 @@ void __blk_mq_finish_request(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, blk_mq_put_tag(hctx, hctx->tags, ctx, rq->tag); if (sched_tag != -1) blk_mq_sched_completed_request(hctx, rq); + if (unbusy) + blk_mq_tag_idle(hctx); + blk_queue_exit(q); } -- 1.8.5.6