]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - block/blk-core.c
blk-mq: I/O and timer unplugs are inverted in blktrace
[mirror_ubuntu-bionic-kernel.git] / block / blk-core.c
index c5d5c8587770394dd4257882c3b1b72bed4f95c9..1a125e3439e45cfede45a771e16ad8f8b685a622 100644 (file)
@@ -703,9 +703,13 @@ void blk_cleanup_queue(struct request_queue *q)
         * 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
+        * from more than one contexts.
+        *
+        * No need to quiesce queue if it isn't initialized yet since
+        * blk_freeze_queue() should be enough for cases of passthrough
+        * request.
         */
-       if (q->mq_ops)
+       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 */
@@ -1083,6 +1087,7 @@ out_exit_flush_rq:
                q->exit_rq_fn(q, q->fq->flush_rq);
 out_free_flush_queue:
        blk_free_flush_queue(q->fq);
+       q->fq = NULL;
        return -ENOMEM;
 }
 EXPORT_SYMBOL(blk_init_allocated_queue);
@@ -3653,9 +3658,11 @@ EXPORT_SYMBOL(blk_finish_plug);
  */
 void blk_pm_runtime_init(struct request_queue *q, struct device *dev)
 {
-       /* not support for RQF_PM and ->rpm_status in blk-mq yet */
-       if (q->mq_ops)
+       /* Don't enable runtime PM for blk-mq until it is ready */
+       if (q->mq_ops) {
+               pm_runtime_disable(dev);
                return;
+       }
 
        q->dev = dev;
        q->rpm_status = RPM_ACTIVE;