Skip to content

Commit

Permalink
blk-mq: don't allow queue entering for a dying queue
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Keith Busch authored and axboe committed Jun 6, 2014
1 parent a4391c6 commit 3b632cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3b632cf

Please sign in to comment.