Patchwork [2/2] virtio-scsi: abort in-flight I/O when the device is reset

login
register
mail settings
Submitter Paolo Bonzini
Date Jan. 10, 2013, 2:49 p.m.
Message ID <1357829348-3496-3-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/211088/
State New
Headers show

Comments

Paolo Bonzini - Jan. 10, 2013, 2:49 p.m.
When the device is reset, the SCSI bus should also be reset so
that in-flight I/O is cancelled.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/virtio-scsi.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c
index bfe1860..0715865 100644
--- a/hw/virtio-scsi.c
+++ b/hw/virtio-scsi.c
@@ -565,6 +565,10 @@  static void virtio_scsi_reset(VirtIODevice *vdev)
 {
     VirtIOSCSI *s = (VirtIOSCSI *)vdev;
 
+    s->resetting++;
+    qbus_reset_all(&s->bus.qbus);
+    s->resetting--;
+
     s->sense_size = VIRTIO_SCSI_SENSE_SIZE;
     s->cdb_size = VIRTIO_SCSI_CDB_SIZE;
     s->events_dropped = false;