qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] quorum: don't share qiov
@ 2015-01-30  8:07 Wen Congyang
  2015-01-30 13:39 ` Kevin Wolf
  0 siblings, 1 reply; 6+ messages in thread
From: Wen Congyang @ 2015-01-30  8:07 UTC (permalink / raw)
  To: qemu-devl, Kevin Wolf, Stefan Hajnoczi

If the child touches qiov->iov, it will cause unexpected results.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
---
 block/quorum.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/block/quorum.c b/block/quorum.c
index cdc026c..ef0c1e9 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -165,6 +165,10 @@ static void quorum_aio_finalize(QuorumAIOCB *acb)
             qemu_vfree(acb->qcrs[i].buf);
             qemu_iovec_destroy(&acb->qcrs[i].qiov);
         }
+    } else {
+        for (i = 0; i <= acb->child_iter; i++) {
+            qemu_iovec_destroy(&acb->qcrs[i].qiov);
+        }
     }
 
     g_free(acb->qcrs);
@@ -709,8 +713,12 @@ static BlockAIOCB *quorum_aio_writev(BlockDriverState *bs,
                                       cb, opaque);
     int i;
 
+    acb->child_iter = s->num_children - 1;
     for (i = 0; i < s->num_children; i++) {
-        acb->qcrs[i].aiocb = bdrv_aio_writev(s->bs[i], sector_num, qiov,
+        qemu_iovec_init(&acb->qcrs[i].qiov, acb->qiov->niov);
+        qemu_iovec_concat(&acb->qcrs[i].qiov, acb->qiov, 0, acb->qiov->size);
+        acb->qcrs[i].aiocb = bdrv_aio_writev(s->bs[i], sector_num,
+                                             &acb->qcrs[i].qiov,
                                              nb_sectors, &quorum_aio_cb,
                                              &acb->qcrs[i]);
     }
-- 
2.1.0

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

end of thread, other threads:[~2015-02-09  2:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-30  8:07 [Qemu-devel] [PATCH] quorum: don't share qiov Wen Congyang
2015-01-30 13:39 ` Kevin Wolf
2015-02-02  1:19   ` Wen Congyang
2015-02-03  9:22     ` Kevin Wolf
2015-02-03 11:01       ` Paolo Bonzini
2015-02-09  2:10         ` Wen Congyang

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