From: Christoph Hellwig Date: Mon, 26 May 2014 09:45:02 +0000 (+0200) Subject: blk-mq: idle all hardware contexts before freeing a queue X-Git-Tag: v3.16-rc1~30^2~49^2~25 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=19c5d84f14d2b01fe4c24e1444142f69e6dc08f6;p=linux.git blk-mq: idle all hardware contexts before freeing a queue Without this we can leak the active_queues reference if a command is freed while it is considered active. Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- diff --git a/block/blk-mq.c b/block/blk-mq.c index 9bc075335d06..62082c5daae7 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1844,6 +1844,7 @@ void blk_mq_free_queue(struct request_queue *q) blk_mq_del_queue_tag_set(q); queue_for_each_hw_ctx(q, hctx, i) { + blk_mq_tag_idle(hctx); kfree(hctx->ctxs); blk_mq_unregister_cpu_notifier(&hctx->cpu_notifier); if (q->mq_ops->exit_hctx)