summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-09-18 09:22:54 -0700
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 08:56:18 +0200
commite3335de94067dbebe22e3962632ead34e832cb60 (patch)
tree93d88fd70ce8af33d9444e9af91a4e0635a64c96
parent9246b5f06deeea541e7c62437c2ad19a0b1172c0 (diff)
block: blk_cleanup_queue() should call blk_sync_queue()
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 <jens.axboe@oracle.com>
-rw-r--r--block/blk-core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index d768a8ddc17..37fba001bdc 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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);