summaryrefslogtreecommitdiffstats
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorDongli Zhang <dongli.zhang@oracle.com>2019-04-04 04:57:44 +0200
committerJens Axboe <axboe@kernel.dk>2019-04-04 16:37:34 +0200
commitbcc816dfe51ab86ca94663c7b225f2d6eb0fddb9 (patch)
tree781a542bc2b440a299c9d41a1dd67bd39ce8f734 /block/blk-mq.c
parentparide/pf: Fix potential NULL pointer dereference (diff)
downloadlinux-bcc816dfe51ab86ca94663c7b225f2d6eb0fddb9.tar.xz
linux-bcc816dfe51ab86ca94663c7b225f2d6eb0fddb9.zip
blk-mq: do not reset plug->rq_count before the list is sorted
We would never be able to sort the list if we first reset plug->rq_count which is used in conditional check later. Fixes: ce5b009cff19 ("block: improve logic around when to sort a plug list") Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 22074a1e37cd..ac61bcc67a89 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1711,11 +1711,12 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
unsigned int depth;
list_splice_init(&plug->mq_list, &list);
- plug->rq_count = 0;
if (plug->rq_count > 2 && plug->multiple_queues)
list_sort(NULL, &list, plug_rq_cmp);
+ plug->rq_count = 0;
+
this_q = NULL;
this_hctx = NULL;
this_ctx = NULL;