From ec8f896fc6e3e2af6431de6499294939345e6cfd Mon Sep 17 00:00:00 2001 From: yangerkun Date: Tue, 13 Aug 2019 22:23:03 +0800 Subject: [PATCH] Revert "block: don't drain in-progress dispatch in blk_cleanup_queue()" hulk inclusion category: bugfix bugzilla: 20127 CVE: NA ------------------------------------------------- This reverts commit cba577a1b9d763f6a02b7800c8b27d293b28a8a4. Commit fbc2a15e3433 ("blk-mq: move cancel of requeue_work into blk_mq_release") introduce that blk_mq_kick_requeue_list can be called after blk_sync_queue in blk_cleanup_queue. And the "quiesce" state can avoid requeue work reuse the structure has been released in blk_exit_queue. Signed-off-by: yangerkun Reviewed-by: zhengbin Signed-off-by: Yang Yingliang --- block/blk-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index 78a4f91abf9c..dcf1ab09e10e 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -784,6 +784,18 @@ void blk_cleanup_queue(struct request_queue *q) queue_flag_set(QUEUE_FLAG_DEAD, q); spin_unlock_irq(lock); + /* + * make sure all in-progress dispatch are completed because + * blk_freeze_queue() can only complete all requests, and + * dispatch may still be in-progress since we dispatch requests + * from more than one contexts. + * + * We rely on driver to deal with the race in case that queue + * initialization isn't done. + */ + if (q->mq_ops && blk_queue_init_done(q)) + blk_mq_quiesce_queue(q); + /* for synchronous bio-based driver finish in-flight integrity i/o */ blk_flush_integrity(); -- GitLab