* [Qemu-devel] [PATCH] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing
@ 2014-06-30 15:09 Greg Kurz
2014-06-30 15:15 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Greg Kurz @ 2014-06-30 15:09 UTC (permalink / raw)
To: Paolo Bonzini, Michael S. Tsirkin; +Cc: qemu-devel
Hotplug of a virtio scsi disk is currently broken: no disk appears in the
guest (verified with a fedora 20 host running a fedora 20 guest with KVM).
Bisect leeds to Paolo's patches to support any_layout, especially this
commit:
commit 36b15c79aa1bef5fe7543f9f2629b6413720bbfb
Author: Paolo Bonzini <pbonzini@redhat.com>
Date: Tue Jun 10 16:21:18 2014 +0200
virtio-scsi: start preparing for any_layout
It modifies virtio_scsi_pop_req() so that it is up to the callers to parse
the virtio scsi request. It seems that virtio_scsi_push_event() was not
modified accordingly...
This patch adds a call to virtio_scsi_parse_req(). It also drops the in size
sanity check since it is already done by virtio_scsi_parse_req(). This is
enough to have hotplug working again.
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---
I guess the following check could also be handled by virtio_scsi_parse_req()
as it does not allow both in and out at the same time, but I am not sure:
if (req->elem.out_num) {
virtio_scsi_bad_req();
}
Thoughts ?
--
Greg
hw/scsi/virtio-scsi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 04ecfa7..0b0a331 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -565,7 +565,6 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
VirtIOSCSIReq *req;
VirtIOSCSIEvent *evt;
VirtIODevice *vdev = VIRTIO_DEVICE(s);
- int in_size;
if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
return;
@@ -586,8 +585,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
s->events_dropped = false;
}
- in_size = iov_size(req->elem.in_sg, req->elem.in_num);
- if (in_size < sizeof(VirtIOSCSIEvent)) {
+ if (virtio_scsi_parse_req(req, 0, sizeof(VirtIOSCSIEvent))) {
virtio_scsi_bad_req();
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing
2014-06-30 15:09 [Qemu-devel] [PATCH] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing Greg Kurz
@ 2014-06-30 15:15 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2014-06-30 15:15 UTC (permalink / raw)
To: Greg Kurz, Michael S. Tsirkin; +Cc: qemu-devel
Il 30/06/2014 17:09, Greg Kurz ha scritto:
> Hotplug of a virtio scsi disk is currently broken: no disk appears in the
> guest (verified with a fedora 20 host running a fedora 20 guest with KVM).
> Bisect leeds to Paolo's patches to support any_layout, especially this
> commit:
>
> commit 36b15c79aa1bef5fe7543f9f2629b6413720bbfb
> Author: Paolo Bonzini <pbonzini@redhat.com>
> Date: Tue Jun 10 16:21:18 2014 +0200
>
> virtio-scsi: start preparing for any_layout
>
> It modifies virtio_scsi_pop_req() so that it is up to the callers to parse
> the virtio scsi request. It seems that virtio_scsi_push_event() was not
> modified accordingly...
>
> This patch adds a call to virtio_scsi_parse_req(). It also drops the in size
> sanity check since it is already done by virtio_scsi_parse_req(). This is
> enough to have hotplug working again.
>
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
>
> I guess the following check could also be handled by virtio_scsi_parse_req()
> as it does not allow both in and out at the same time, but I am not sure:
>
> if (req->elem.out_num) {
> virtio_scsi_bad_req();
> }
>
> Thoughts ?
>
> --
> Greg
>
> hw/scsi/virtio-scsi.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 04ecfa7..0b0a331 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -565,7 +565,6 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
> VirtIOSCSIReq *req;
> VirtIOSCSIEvent *evt;
> VirtIODevice *vdev = VIRTIO_DEVICE(s);
> - int in_size;
>
> if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
> return;
> @@ -586,8 +585,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
> s->events_dropped = false;
> }
>
> - in_size = iov_size(req->elem.in_sg, req->elem.in_num);
> - if (in_size < sizeof(VirtIOSCSIEvent)) {
> + if (virtio_scsi_parse_req(req, 0, sizeof(VirtIOSCSIEvent))) {
> virtio_scsi_bad_req();
> }
>
>
>
>
Looks good. I'll queue the fix.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-30 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-30 15:09 [Qemu-devel] [PATCH] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing Greg Kurz
2014-06-30 15:15 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.