diff --git a/block/blk-core.c b/block/blk-core.c index accb7fc6ec944a59651e1e8a43a4319eb2df1cca..c00e0bdeab4ab4724c42b379717200d405d9c584 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -246,7 +246,16 @@ EXPORT_SYMBOL(blk_stop_queue); void blk_sync_queue(struct request_queue *q) { del_timer_sync(&q->timeout); - cancel_delayed_work_sync(&q->delay_work); + + if (q->mq_ops) { + struct blk_mq_hw_ctx *hctx; + int i; + + queue_for_each_hw_ctx(q, hctx, i) + cancel_delayed_work_sync(&hctx->delayed_work); + } else { + cancel_delayed_work_sync(&q->delay_work); + } } EXPORT_SYMBOL(blk_sync_queue); diff --git a/block/blk-mq.c b/block/blk-mq.c index e2f811cba4170e1048c1046c2955e881e05736a9..edbd2536f942376f49d6acf663be884b7fc8d4e9 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1440,7 +1440,6 @@ void blk_mq_free_queue(struct request_queue *q) int i; queue_for_each_hw_ctx(q, hctx, i) { - cancel_delayed_work_sync(&hctx->delayed_work); kfree(hctx->ctx_map); kfree(hctx->ctxs); blk_mq_free_rq_map(hctx);