On Sun, 2017-11-05 at 20:10 +0800, Ming Lei wrote:
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 048be4aa6024..0b121f29e3b1 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -658,6 +658,10 @@ void blk_cleanup_queue(struct request_queue *q)
>       queue_flag_set(QUEUE_FLAG_DEAD, q);
>       spin_unlock_irq(lock);
>  
> +     /* respect queue DEAD via quiesce for blk-mq */
> +     if (q->mq_ops)
> +             blk_mq_quiesce_queue(q);
> +
>       /* for synchronous bio-based driver finish in-flight integrity i/o */
>       blk_flush_integrity();

Have you considered to change the blk_freeze_queue_start() call in
blk_set_queue_dying() into a blk_freeze_queue() call? That approach has the
advantage that no new if (q->mq_ops) test has to be introduced.

Additionally, the call trace in the description of this patch shows that the
comment in blk_execute_rq_nowait() is wrong. How about changing that comment
as follows?

@@ -57,10 +57,12 @@ void blk_execute_rq_nowait(struct request_queue *q, struct 
gendisk *bd_disk,
        rq->end_io = done;
 
        /*
-        * don't check dying flag for MQ because the request won't
-        * be reused after dying flag is set
+        * blk_freeze_queue() must be called before transitioning a queue
+        * into the "dead" state to guarantee that blk_execute_rq_nowait()
+        * won't attempt to queue a request on a "dead" blk-mq queue.
         */
        if (q->mq_ops) {
+               WARN_ON_ONCE(blk_queue_dead(q));
                blk_mq_sched_insert_request(rq, at_head, true, false, false);
                return;
        }

Bart.

Reply via email to