619821
From a7cfda7b304697450f0a55c22f4459b25999e9c5 Mon Sep 17 00:00:00 2001
619821
From: Max Reitz <mreitz@redhat.com>
619821
Date: Mon, 13 Mar 2017 17:47:05 +0100
619821
Subject: [PATCH 17/24] vhdx: Fix zero-fill iov length
619821
619821
RH-Author: Max Reitz <mreitz@redhat.com>
619821
Message-id: <20170313174706.29316-2-mreitz@redhat.com>
619821
Patchwork-id: 74279
619821
O-Subject: [RHEL-7.4 qemu-kvm PATCH 8/9] vhdx: Fix zero-fill iov length
619821
Bugzilla: 1427176
619821
RH-Acked-by: Fam Zheng <famz@redhat.com>
619821
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
619821
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
619821
619821
From: Kevin Wolf <kwolf@redhat.com>
619821
619821
Fix the length of the zero-fill for the back, which was accidentally
619821
using the same value as for the front. This is caught by qemu-iotests
619821
033.
619821
619821
For consistency, change the code for the front as well to use the length
619821
stored in the iov (it is the same value, copied four lines above).
619821
619821
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
619821
Acked-by: Jeff Cody <jcody@redhat.com>
619821
(cherry picked from commit d1a126c53ddc563b7b731cee013e0362f7a5f22f)
619821
Signed-off-by: Max Reitz <mreitz@redhat.com>
619821
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
619821
---
619821
 block/vhdx.c | 4 ++--
619821
 1 file changed, 2 insertions(+), 2 deletions(-)
619821
619821
diff --git a/block/vhdx.c b/block/vhdx.c
619821
index 21ad6ad..47a872d 100644
619821
--- a/block/vhdx.c
619821
+++ b/block/vhdx.c
619821
@@ -1247,7 +1247,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num,
619821
                         iov1.iov_base = qemu_blockalign(bs, iov1.iov_len);
619821
                         memset(iov1.iov_base, 0, iov1.iov_len);
619821
                         qemu_iovec_concat_iov(&hd_qiov, &iov1, 1, 0,
619821
-                                              sinfo.block_offset);
619821
+                                              iov1.iov_len);
619821
                         sectors_to_write += iov1.iov_len >> BDRV_SECTOR_BITS;
619821
                     }
619821
 
619821
@@ -1263,7 +1263,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num,
619821
                         iov2.iov_base = qemu_blockalign(bs, iov2.iov_len);
619821
                         memset(iov2.iov_base, 0, iov2.iov_len);
619821
                         qemu_iovec_concat_iov(&hd_qiov, &iov2, 1, 0,
619821
-                                              sinfo.block_offset);
619821
+                                              iov2.iov_len);
619821
                         sectors_to_write += iov2.iov_len >> BDRV_SECTOR_BITS;
619821
                     }
619821
                 }
619821
-- 
619821
1.8.3.1
619821