[Devel] [PATCH RHEL7 COMMIT] ploop: Fix kaio_sync_io() for multy-pages case

Vasily Averin vvs at virtuozzo.com
Mon Aug 17 09:52:31 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.2
------>
commit 2402191ed746a0866578dea74fda7316dfe68ed7
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon Aug 17 09:52:31 2020 +0300

    ploop: Fix kaio_sync_io() for multy-pages case
    
    @bvec is pointer to the first element of the array,
    so we can't lost pointer to it.
    
    Note, that the fix has no a visible effect, as this
    function is currently called for nr_pages=1 case only
    (kaio is not populating holes_bitmap on mount at
    the moment).
    
    https://jira.sw.ru/browse/PSBM-105347
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/io_kaio.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 87287af..1151b86 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -793,7 +793,7 @@ kaio_sync_io(struct ploop_io * io, int op, struct page **pages,
 {
 	struct kiocb *iocb;
 	struct iov_iter iter;
-	struct bio_vec bvec_on_stack, *bvec;
+	struct bio_vec bvec_on_stack, *bvec, *tmp;
 	loff_t pos = (loff_t) sec << 9;
 	struct file *file = io->files.file;
 	struct kaio_comp comp;
@@ -814,15 +814,17 @@ kaio_sync_io(struct ploop_io * io, int op, struct page **pages,
 		return -ENOMEM;
 	}
 
+	tmp = bvec;
 	for (i = 0; i < nr_pages; i++) {
-		bvec->bv_page = pages[i];
+		tmp->bv_page = pages[i];
 		count = PAGE_SIZE - off;
 		if (count > len)
 			count = len;
-		bvec->bv_len = count;
-		bvec->bv_offset = off;
+		tmp->bv_len = count;
+		tmp->bv_offset = off;
 		off = 0;
 		len -= count;
+		tmp++;
 	}
 
 	iov_iter_init_bvec(&iter, bvec, nr_pages, bvec_length(bvec, nr_pages), 0);


More information about the Devel mailing list