qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-blk: Return UNSUPP for unknown request types
@ 2012-12-13  6:49 Alexey Zaytsev
  0 siblings, 0 replies; 3+ messages in thread
From: Alexey Zaytsev @ 2012-12-13  6:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Alexey Zaytsev, Stefan Hajnoczi

Currently, all unknown requests are treated as VIRTIO_BLK_T_IN

Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
---
 hw/virtio-blk.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index e25cc96..1f59a76 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -392,10 +392,14 @@ static void virtio_blk_handle_request(VirtIOBlockReq *req,
         qemu_iovec_init_external(&req->qiov, &req->elem.out_sg[1],
                                  req->elem.out_num - 1);
         virtio_blk_handle_write(req, mrb);
-    } else {
+    } else if (type == VIRTIO_BLK_T_IN || type == VIRTIO_BLK_T_BARRIER) {
+	/* VIRTIO_BLK_T_IN is 0, so we can't just & it. */
         qemu_iovec_init_external(&req->qiov, &req->elem.in_sg[0],
                                  req->elem.in_num - 1);
         virtio_blk_handle_read(req);
+    } else {
+        virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP);
+        f_free(req);
     }
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH] virtio-blk: Return UNSUPP for unknown request types
@ 2012-12-13  7:03 Alexey Zaytsev
  2012-12-18 13:58 ` Stefan Hajnoczi
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Zaytsev @ 2012-12-13  7:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Alexey Zaytsev, Stefan Hajnoczi

Currently, all unknown requests are treated as VIRTIO_BLK_T_IN

Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
---
Sorry, made a typo when formatting the patch, please consider this one.

 hw/virtio-blk.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index e25cc96..c47951a 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -392,10 +392,14 @@ static void virtio_blk_handle_request(VirtIOBlockReq *req,
         qemu_iovec_init_external(&req->qiov, &req->elem.out_sg[1],
                                  req->elem.out_num - 1);
         virtio_blk_handle_write(req, mrb);
-    } else {
+    } else if (type == VIRTIO_BLK_T_IN || type == VIRTIO_BLK_T_BARRIER) {
+        /* VIRTIO_BLK_T_IN is 0, so we can't just & it. */
         qemu_iovec_init_external(&req->qiov, &req->elem.in_sg[0],
                                  req->elem.in_num - 1);
         virtio_blk_handle_read(req);
+    } else {
+        virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP);
+        g_free(req);
     }
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-blk: Return UNSUPP for unknown request types
  2012-12-13  7:03 [Qemu-devel] [PATCH] virtio-blk: Return UNSUPP for unknown request types Alexey Zaytsev
@ 2012-12-18 13:58 ` Stefan Hajnoczi
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2012-12-18 13:58 UTC (permalink / raw)
  To: Alexey Zaytsev; +Cc: Kevin Wolf, qemu-devel

On Thu, Dec 13, 2012 at 09:03:43AM +0200, Alexey Zaytsev wrote:
> Currently, all unknown requests are treated as VIRTIO_BLK_T_IN
> 
> Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
> ---
> Sorry, made a typo when formatting the patch, please consider this one.
> 
>  hw/virtio-blk.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-18 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-13  7:03 [Qemu-devel] [PATCH] virtio-blk: Return UNSUPP for unknown request types Alexey Zaytsev
2012-12-18 13:58 ` Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2012-12-13  6:49 Alexey Zaytsev

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).