qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-blk: Release s->rq queue at system_reset
@ 2016-07-29 10:22 Fam Zheng
  2016-07-29 10:41 ` Laszlo Ersek
  2016-08-02  6:46 ` Paolo Bonzini
  0 siblings, 2 replies; 6+ messages in thread
From: Fam Zheng @ 2016-07-29 10:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, lersek

At system_reset, there is no point in retrying the queued request,
because the driver that issued the request won't be around any more.

Analyzed-by: Laszlo Ersek <lersek@redhat.com>
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 hw/block/virtio-blk.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 475a822..89eca65 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -654,6 +654,7 @@ static void virtio_blk_reset(VirtIODevice *vdev)
 {
     VirtIOBlock *s = VIRTIO_BLK(vdev);
     AioContext *ctx;
+    VirtIOBlockReq *req;
 
     /*
      * This should cancel pending requests, but can't do nicely until there
@@ -661,6 +662,11 @@ static void virtio_blk_reset(VirtIODevice *vdev)
      */
     ctx = blk_get_aio_context(s->blk);
     aio_context_acquire(ctx);
+    while (s->rq) {
+        req = s->rq;
+        s->rq = req->next;
+        virtio_blk_free_request(req);
+    }
     blk_drain(s->blk);
 
     if (s->dataplane) {
-- 
2.7.4

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

end of thread, other threads:[~2016-08-02  7:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-29 10:22 [Qemu-devel] [PATCH] virtio-blk: Release s->rq queue at system_reset Fam Zheng
2016-07-29 10:41 ` Laszlo Ersek
2016-08-01  2:54   ` Fam Zheng
2016-08-02  6:46 ` Paolo Bonzini
2016-08-02  7:24   ` Fam Zheng
2016-08-02  7:29     ` Fam Zheng

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