In MQ scheduler, q->nr_requests represents requests in scheduler queue depth, so don't update it if hw queue's depth is updated. Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> --- block/blk-mq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index be475ad112ec..681bf33d8de8 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2643,6 +2643,7 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr) struct blk_mq_tag_set *set = q->tag_set; struct blk_mq_hw_ctx *hctx; int i, ret; + bool sched = false; if (!set) return -EINVAL; @@ -2664,12 +2665,13 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr) } else { ret = blk_mq_tag_update_depth(hctx, &hctx->sched_tags, nr, true); + sched = true; } if (ret) break; } - if (!ret) + if (!ret && sched) q->nr_requests = nr; blk_mq_unfreeze_queue(q); -- 2.9.3