* [Qemu-devel] [Patch] block:qemu will crash when vhost-scsi disk vm reboot
@ 2014-09-01 9:33 Zhang Min
2014-09-01 9:38 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Min @ 2014-09-01 9:33 UTC (permalink / raw)
To: qemu-devel
Cc: subo7, mst, peter.huangpeng, boby.chen, pbonzini, Zhang Min,
wu.wubin
From: subo <subo7@huawei.com>
When the vm reboot, it will call virtio_scsi_handle_event(),
for vhost-scsi device,vdev is VIRTIO_SCSI_COMMON, not VIRTIO_SCSI,
if vdev convert to the VIRTIO_SCSI, it will cause qemu crash.
Signed-off-by: Zhang Min <rudy.zhangmin@huawei.com>
Signed-off-by: subo <subo7@huawei.com>
---
hw/scsi/virtio-scsi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 86aba88..7d3bc49 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -630,7 +630,11 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq)
{
- VirtIOSCSI *s = VIRTIO_SCSI(vdev);
+ VirtIOSCSI *s;
+
+ s = (VirtIOSCSI *)object_dynamic_cast((Object *)vdev, TYPE_VIRTIO_SCSI);
+ if (!s)
+ return;
if (s->events_dropped) {
virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0);
--
1.8.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [Patch] block:qemu will crash when vhost-scsi disk vm reboot
2014-09-01 9:33 [Qemu-devel] [Patch] block:qemu will crash when vhost-scsi disk vm reboot Zhang Min
@ 2014-09-01 9:38 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2014-09-01 9:38 UTC (permalink / raw)
To: Zhang Min, qemu-devel; +Cc: peter.huangpeng, boby.chen, wu.wubin, subo7, mst
Il 01/09/2014 11:33, Zhang Min ha scritto:
> From: subo <subo7@huawei.com>
>
> When the vm reboot, it will call virtio_scsi_handle_event(),
> for vhost-scsi device,vdev is VIRTIO_SCSI_COMMON, not VIRTIO_SCSI,
> if vdev convert to the VIRTIO_SCSI, it will cause qemu crash.
>
> Signed-off-by: Zhang Min <rudy.zhangmin@huawei.com>
> Signed-off-by: subo <subo7@huawei.com>
> ---
> hw/scsi/virtio-scsi.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 86aba88..7d3bc49 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -630,7 +630,11 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
>
> static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq)
> {
> - VirtIOSCSI *s = VIRTIO_SCSI(vdev);
> + VirtIOSCSI *s;
> +
> + s = (VirtIOSCSI *)object_dynamic_cast((Object *)vdev, TYPE_VIRTIO_SCSI);
> + if (!s)
> + return;
>
> if (s->events_dropped) {
> virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0);
>
Should be already fixed in 2.1 by commit 91d670f (virtio-scsi: define
dummy handle_output for vhost-scsi vqs, 2014-06-19).
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-01 9:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-01 9:33 [Qemu-devel] [Patch] block:qemu will crash when vhost-scsi disk vm reboot Zhang Min
2014-09-01 9:38 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).