Skip to contentSkip to conversation

block: wake up all tasks blocked in get_request()

PATCH In review Ming Lei 2 participants 2 messages Nov 16, 2017 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block: wake up all tasks blocked in get_request()

Once blk_set_queue_dying() is done in blk_cleanup_queue(), we call blk_freeze_queue() and wait for q->q_usage_counter becoming zero. But if there are tasks blocked in get_request(), q->q_usage_counter can never become zero. So we have to wake up all these tasks in blk_set_queue_dying() first.

Fixes 3ef28e83ab157997(block: generic request_queue reference counting)
---
 block/blk-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-core.c +2 -2
index 7c54c195e79e..1038706edd87 100644
@@ -637,8 +637,8 @@ void blk_set_queue_dying(struct request_queue *q)
 		spin_lock_irq(q->queue_lock);
 		blk_queue_for_each_rl(rl, q) {
 			if (rl->rq_pool) {
-				wake_up(&rl->wait[BLK_RW_SYNC]);
-				wake_up(&rl->wait[BLK_RW_ASYNC]);
+				wake_up_all(&rl->wait[BLK_RW_SYNC]);
+				wake_up_all(&rl->wait[BLK_RW_ASYNC]);
 			}
 		}
 		spin_unlock_irq(q->queue_lock);
Signature · 1 line
2.9.5
maintainer
#1 lore raw
Quoted 5 lines · Ming Lei

Once blk_set_queue_dying() is done in blk_cleanup_queue(), we call blk_freeze_queue() and wait for q->q_usage_counter becoming zero. But if there are tasks blocked in get_request(), q->q_usage_counter can never become zero. So we have to wake up all these tasks in blk_set_queue_dying() first.

Looks correct to me, since we do exclusive waits on that waitqueue. Applied for this series.

Quoted 1 line
Fixes 3ef28e83ab157997(block: generic request_queue reference counting)

Note that the format here is ("patch title")

Signature · 1 line
Jens Axboe