blk-mq: don't allow queue entering for a dying queue
authorKeith Busch <keith.busch@intel.com>
Fri, 6 Jun 2014 16:22:07 +0000 (10:22 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 6 Jun 2014 16:40:03 +0000 (10:40 -0600)
If the queue is going away, don't let new allocs or queueing
happen on it. Go through the normal wait process, and exit with
ENODEV in that case.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq.c

index a6ee74e27957eab3aedb33612d56a582d38b65b5..75fc33f342516c883231ca16b3c2129ff386a624 100644 (file)
@@ -82,8 +82,10 @@ static int blk_mq_queue_enter(struct request_queue *q)
 
        __percpu_counter_add(&q->mq_usage_counter, 1, 1000000);
        smp_wmb();
-       /* we have problems to freeze the queue if it's initializing */
-       if (!blk_queue_bypass(q) || !blk_queue_init_done(q))
+
+       /* we have problems freezing the queue if it's initializing */
+       if (!blk_queue_dying(q) &&
+           (!blk_queue_bypass(q) || !blk_queue_init_done(q)))
                return 0;
 
        __percpu_counter_add(&q->mq_usage_counter, -1, 1000000);