Skip to content

Commit

Permalink
block: blk_cleanup_queue() should call blk_sync_queue()
Browse files Browse the repository at this point in the history
When a driver calls blk_cleanup_queue(), the device should be fully idle.
However, the block layer may have pending plugging timers and the IO
schedulers may have pending work in the work queues. So quisce the device
by waiting for the timer and flushing the work queues.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Jens Axboe committed Oct 9, 2008
1 parent 9246b5f commit e3335de
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,14 @@ void blk_put_queue(struct request_queue *q)

void blk_cleanup_queue(struct request_queue *q)
{
/*
* We know we have process context here, so we can be a little
* cautious and ensure that pending block actions on this device
* are done before moving on. Going into this function, we should
* not have processes doing IO to this device.
*/
blk_sync_queue(q);

mutex_lock(&q->sysfs_lock);
queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q);
mutex_unlock(&q->sysfs_lock);
Expand Down

0 comments on commit e3335de

Please sign in to comment.