Page MenuHomeFreeBSD

D30049.diff
No OneTemporary

D30049.diff

diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c
--- a/sys/dev/virtio/block/virtio_blk.c
+++ b/sys/dev/virtio/block/virtio_blk.c
@@ -126,6 +126,7 @@
static int vtblk_suspend(device_t);
static int vtblk_resume(device_t);
static int vtblk_shutdown(device_t);
+static int vtblk_attach_completed(device_t);
static int vtblk_config_change(device_t);
static int vtblk_open(struct disk *);
@@ -255,6 +256,7 @@
DEVMETHOD(device_shutdown, vtblk_shutdown),
/* VirtIO methods. */
+ DEVMETHOD(virtio_attach_completed, vtblk_attach_completed),
DEVMETHOD(virtio_config_change, vtblk_config_change),
DEVMETHOD_END
@@ -378,8 +380,6 @@
goto fail;
}
- vtblk_create_disk(sc);
-
virtqueue_enable_intr(sc->vtblk_vq);
fail:
@@ -461,6 +461,22 @@
return (0);
}
+static int
+vtblk_attach_completed(device_t dev)
+{
+ struct vtblk_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ /*
+ * Create disk after attach as VIRTIO_BLK_T_GET_ID can only be
+ * processed after the device acknowledged
+ * VIRTIO_CONFIG_STATUS_DRIVER_OK.
+ */
+ vtblk_create_disk(sc);
+ return (0);
+}
+
static int
vtblk_config_change(device_t dev)
{

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 9:52 PM (19 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14561908
Default Alt Text
D30049.diff (1 KB)

Event Timeline