Commit fbc2a15e authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe
Browse files

blk-mq: move cancel of requeue_work into blk_mq_release

With holding queue's kobject refcount, it is safe for driver
to schedule requeue. However, blk_mq_kick_requeue_list() may
be called after blk_sync_queue() is done because of concurrent
requeue activities, then requeue work may not be completed when
freeing queue, and kernel oops is triggered.

So moving the cancel of requeue_work into blk_mq_release() for
avoiding race between requeue and freeing queue.

Cc: Dongli Zhang <>
Cc: James Smart <>
Cc: Bart Van Assche <>
Cc: Martin K . Petersen <>,
Cc: Christoph Hellwig <>,
Cc: James E . J . Bottomley <>,
Reviewed-by: default avatarBart Van Assche <>
Reviewed-by: default avatarJohannes Thumshirn <>
Reviewed-by: default avatarHannes Reinecke <>
Reviewed-by: default avatarChristoph Hellwig <>
Tested-by: default avatarJames Smart <>
Signed-off-by: default avatarMing Lei <>
Signed-off-by: default avatarJens Axboe <>
parent e87eb301
......@@ -238,7 +238,6 @@ void blk_sync_queue(struct request_queue *q)
struct blk_mq_hw_ctx *hctx;
int i;
queue_for_each_hw_ctx(q, hctx, i)
......@@ -2635,6 +2635,8 @@ void blk_mq_release(struct request_queue *q)
struct blk_mq_hw_ctx *hctx;
unsigned int i;
/* hctx kobj stays in hctx */
queue_for_each_hw_ctx(q, hctx, i) {
if (!hctx)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment