blk-mq: fix leak of q->stats
authorOmar Sandoval <osandov@fb.com>
Tue, 28 Mar 2017 23:12:16 +0000 (16:12 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 29 Mar 2017 14:09:08 +0000 (08:09 -0600)
blk_alloc_queue_node() already allocates q->stats, so
blk_mq_init_allocated_queue() is overwriting it with a new allocation.

Fixes: a83b576c9c25 ("block: fix stacked driver stats init and free")
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq.c

index 0ed00eca4d5adbfb27e6e35a6334ee55a723ffcf..182776877a55fea8f0c7a748fd34cb4fa33f34db 100644 (file)
@@ -2234,10 +2234,6 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
        /* mark the queue as mq asap */
        q->mq_ops = set->ops;
 
-       q->stats = blk_alloc_queue_stats();
-       if (!q->stats)
-               goto err_exit;
-
        q->poll_cb = blk_stat_alloc_callback(blk_mq_poll_stats_fn,
                                             blk_stat_rq_ddir, 2, q);
        if (!q->poll_cb)