[Devel] [PATCH RHEL8 COMMIT] dm-ploop: Fix detection of unallocated clusters on write

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jan 27 17:00:37 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.4
------>
commit aac7255e284c7eace406fc77bf47c96f97d5ad9b
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Jan 27 17:00:37 2021 +0300

    dm-ploop: Fix detection of unallocated clusters on write
    
    bio_vec may start from bi_idx != 0 and has bi_bvec_done != 0
    in case of it was created by bio_split().
    
    https://jira.sw.ru/browse/PSBM-124701
    Fixes: 8d9b6a497597 "dm-ploop: Skip zero writes to unallocated clusters"
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index f193b25cbd28..2b9d006b3777 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -401,11 +401,15 @@ static bool bio_endio_if_all_zeros(struct bio *bio)
 {
 	struct bvec_iter bi = {
 		.bi_size = bio->bi_iter.bi_size,
+		.bi_bvec_done = bio->bi_iter.bi_bvec_done,
+		.bi_idx = bio->bi_iter.bi_idx,
 	};
 	struct bio_vec bv;
 	void *data, *ret;
 
 	for_each_bvec(bv, bio->bi_io_vec, bi, bi) {
+		if (!bv.bv_len)
+			continue;
 		data = kmap(bv.bv_page);
 		ret = memchr_inv(data + bv.bv_offset, 0, bv.bv_len);
 		kunmap(bv.bv_page);


More information about the Devel mailing list