From 1f0aa1e17afbe58821c6fec9f0c81d07154c8dc5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 27 Nov 2018 17:07:17 -0700 Subject: [PATCH] blk-mq: fix failure to decrement plug count on single rq removal to #29139300 commit 4711b57317f0ff5ca9fbd5e2df6c73b2c07ddc53 upstream If we yank a 'same_queue_rq' request off the plug list, we should also decrement the cached request count. Fixes: 5f0ed774ed29 ("block: sum requests in the plug structure") Signed-off-by: Jens Axboe Signed-off-by: Hongnan Li Reviewed-by: Joseph Qi Signed-off-by: Joseph Qi --- 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 1bf41f83737d..224c2c73cedf 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1986,8 +1986,10 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) */ if (list_empty(&plug->mq_list)) same_queue_rq = NULL; - if (same_queue_rq) + if (same_queue_rq) { list_del_init(&same_queue_rq->queuelist); + plug->rq_count--; + } blk_add_rq_to_plug(plug, rq); blk_mq_put_ctx(data.ctx); -- GitLab