summaryrefslogtreecommitdiffstats
path: root/drivers/block/virtio_blk.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-10-15 01:52:30 +0200
committerRusty Russell <rusty@rustcorp.com.au>2014-10-15 01:55:02 +0200
commit7a11370e5e6c26566904bb7f08281093a3002ff2 (patch)
tree2d63d93824a632ed1ca62f081d85e87a8ef214a4 /drivers/block/virtio_blk.c
parentvirtio_net: enable VQs early (diff)
downloadlinux-7a11370e5e6c26566904bb7f08281093a3002ff2.tar.xz
linux-7a11370e5e6c26566904bb7f08281093a3002ff2.zip
virtio_blk: enable VQs early
virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after probe returns, virtio block violated this rule by calling add_disk, which causes the VQ to be used directly within probe. To fix, call virtio_device_ready before using VQs. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r--drivers/block/virtio_blk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 89ba8d6baa94..34ec273b1d46 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -719,6 +719,8 @@ static int virtblk_probe(struct virtio_device *vdev)
if (!err && opt_io_size)
blk_queue_io_opt(q, blk_size * opt_io_size);
+ virtio_device_ready(vdev);
+
add_disk(vblk->disk);
err = device_create_file(disk_to_dev(vblk->disk), &dev_attr_serial);
if (err)