If we go over the maximum number of iovecs support by syscall we get
back EINVAL from the kernel which translate to I/O errors for the guest.

Signed-off-by: Christoph Hellwig <h...@lst.de>

Index: qemu/block.c
===================================================================
--- qemu.orig/block.c   2010-01-19 22:10:19.797003226 +0100
+++ qemu/block.c        2010-01-19 22:11:08.226005767 +0100
@@ -1711,6 +1711,10 @@ static int multiwrite_merge(BlockDriverS
             merge = bs->drv->bdrv_merge_requests(bs, &reqs[outidx], &reqs[i]);
         }
 
+        if (reqs[outidx].qiov->niov + reqs[i].qiov->niov + 1 > IOV_MAX) {
+            merge = 0;
+        }
+
         if (merge) {
             size_t size;
             QEMUIOVector *qiov = qemu_mallocz(sizeof(*qiov));


Reply via email to