drm/amd/display: fix a couple of spelling mistakes
[sfrench/cifs-2.6.git] / block / blk-core.c
index ee1b35fe85726790566534641ebc79b91d7117ee..8340f69670d89625a8adc55a24e9c4e547555d7f 100644 (file)
@@ -320,6 +320,19 @@ void blk_cleanup_queue(struct request_queue *q)
        if (queue_is_mq(q))
                blk_mq_exit_queue(q);
 
+       /*
+        * In theory, request pool of sched_tags belongs to request queue.
+        * However, the current implementation requires tag_set for freeing
+        * requests, so free the pool now.
+        *
+        * Queue has become frozen, there can't be any in-queue requests, so
+        * it is safe to free requests now.
+        */
+       mutex_lock(&q->sysfs_lock);
+       if (q->elevator)
+               blk_mq_sched_free_requests(q);
+       mutex_unlock(&q->sysfs_lock);
+
        percpu_ref_exit(&q->q_usage_counter);
 
        /* @q is and will stay empty, shutdown and put */