[Devel] [PATCH RH8] dm-ploop: Fix detection of unallocated clusters on write
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Jan 19 20:47:27 MSK 2021
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 316fd3892f6e..74f9b199d273 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