1 Subject: block: blk_cleanup_queue() should call blk_sync_queue()
2 From: Jens Axboe <jens.axboe@oracle.com>
3 Date: Thu Oct 9 08:56:18 2008 +0200:
4 Git: e3335de94067dbebe22e3962632ead34e832cb60
6 When a driver calls blk_cleanup_queue(), the device should be fully idle.
7 However, the block layer may have pending plugging timers and the IO
8 schedulers may have pending work in the work queues. So quisce the device
9 by waiting for the timer and flushing the work queues.
11 Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
12 Signed-off-by: Hannes Reinecke <hare@suse.de>
15 block/blk-core.c | 8 ++++++++
16 1 file changed, 8 insertions(+)
18 --- a/block/blk-core.c
19 +++ b/block/blk-core.c
20 @@ -435,6 +435,14 @@ void blk_put_queue(struct request_queue
22 void blk_cleanup_queue(struct request_queue *q)
25 + * We know we have process context here, so we can be a little
26 + * cautious and ensure that pending block actions on this device
27 + * are done before moving on. Going into this function, we should
28 + * not have processes doing IO to this device.
32 mutex_lock(&q->sysfs_lock);
33 queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q);
34 mutex_unlock(&q->sysfs_lock);