[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen staging-4.14] block: Fix bdrv_aligned_p*v() for qiov_offset != 0



commit dcf682dd135e41150b8f1918d7902e2305d19e1a
Author:     Max Reitz <mreitz@xxxxxxxxxx>
AuthorDate: Tue Jul 28 14:08:04 2020 +0200
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Wed Sep 9 18:51:39 2020 -0500

    block: Fix bdrv_aligned_p*v() for qiov_offset != 0
    
    Since these functions take a @qiov_offset, they must always take it into
    account when working with @qiov.  There are a couple of places where
    they do not, but they should.
    
    Fixes: 65cd4424b9df03bb5195351c33e04cbbecc0705c
           ("block/io: bdrv_aligned_preadv: use and support qiov_offset")
    Fixes: 28c4da28695bdbe04b336b2c9c463876cc3aaa6d
           ("block/io: bdrv_aligned_pwritev: use and support qiov_offset")
    Reported-by: Claudio Fontana <cfontana@xxxxxxx>
    Reported-by: Bruce Rogers <brogers@xxxxxxxx>
    Cc: qemu-stable@xxxxxxxxxx
    Signed-off-by: Max Reitz <mreitz@xxxxxxxxxx>
    Message-Id: <20200728120806.265916-2-mreitz@xxxxxxxxxx>
    Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@xxxxxxxxxxxxx>
    Tested-by: Claudio Fontana <cfontana@xxxxxxx>
    Tested-by: Bruce Rogers <brogers@xxxxxxxx>
    (cherry picked from commit 134b7dec6ec2d90616d7986afb3b3b7ca7a4c383)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 block/io.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/block/io.c b/block/io.c
index aba67f66b9..496c813dd8 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1501,12 +1501,13 @@ static int coroutine_fn bdrv_aligned_preadv(BdrvChild 
*child,
             assert(num);
 
             ret = bdrv_driver_preadv(bs, offset + bytes - bytes_remaining,
-                                     num, qiov, bytes - bytes_remaining, 0);
+                                     num, qiov,
+                                     qiov_offset + bytes - bytes_remaining, 0);
             max_bytes -= num;
         } else {
             num = bytes_remaining;
-            ret = qemu_iovec_memset(qiov, bytes - bytes_remaining, 0,
-                                    bytes_remaining);
+            ret = qemu_iovec_memset(qiov, qiov_offset + bytes - 
bytes_remaining,
+                                    0, bytes_remaining);
         }
         if (ret < 0) {
             goto out;
@@ -2009,7 +2010,8 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild 
*child,
             }
 
             ret = bdrv_driver_pwritev(bs, offset + bytes - bytes_remaining,
-                                      num, qiov, bytes - bytes_remaining,
+                                      num, qiov,
+                                      qiov_offset + bytes - bytes_remaining,
                                       local_flags);
             if (ret < 0) {
                 break;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.14



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.