From: Zhang Min <rudy.zhangmin@huawei.com>
To: qemu-devel@nongnu.org
Cc: subo7@huawei.com, mst@redhat.com, peter.huangpeng@huawei.com,
boby.chen@huawei.com, pbonzini@redhat.com,
Zhang Min <rudy.zhangmin@huawei.com>,
wu.wubin@huawei.com
Subject: [Qemu-devel] [Patch] block:qemu will crash when vhost-scsi disk vm reboot
Date: Mon, 1 Sep 2014 17:33:15 +0800 [thread overview]
Message-ID: <1409563995-9792-1-git-send-email-rudy.zhangmin@huawei.com> (raw)
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
next reply other threads:[~2014-09-01 9:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-01 9:33 Zhang Min [this message]
2014-09-01 9:38 ` [Qemu-devel] [Patch] block:qemu will crash when vhost-scsi disk vm reboot Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409563995-9792-1-git-send-email-rudy.zhangmin@huawei.com \
--to=rudy.zhangmin@huawei.com \
--cc=boby.chen@huawei.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=subo7@huawei.com \
--cc=wu.wubin@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).