|
|
495e37 |
From d374d5aa4485a0c62d6b48eec64491cae2fd0873 Mon Sep 17 00:00:00 2001
|
|
|
495e37 |
From: Peter Lieven <pl@kamp.de>
|
|
|
495e37 |
Date: Thu, 13 Jan 2022 15:44:25 +0100
|
|
|
495e37 |
Subject: [PATCH 4/5] block/rbd: fix handling of holes in .bdrv_co_block_status
|
|
|
495e37 |
|
|
|
495e37 |
RH-Author: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
495e37 |
RH-MergeRequest: 68: block/rbd: fix handling of holes in .bdrv_co_block_status
|
|
|
495e37 |
RH-Commit: [1/2] 8ef178b01885e3c292f7844ccff865b1a8d4faf0 (sgarzarella/qemu-kvm-c-9-s)
|
|
|
495e37 |
RH-Bugzilla: 2034791
|
|
|
495e37 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
495e37 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
495e37 |
RH-Acked-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
495e37 |
|
|
|
495e37 |
the assumption that we can't hit a hole if we do not diff against a snapshot was wrong.
|
|
|
495e37 |
|
|
|
495e37 |
We can see a hole in an image if we diff against base if there exists an older snapshot
|
|
|
495e37 |
of the image and we have discarded blocks in the image where the snapshot has data.
|
|
|
495e37 |
|
|
|
495e37 |
Fix this by simply handling a hole like an unallocated area. There are no callbacks
|
|
|
495e37 |
for unallocated areas so just bail out if we hit a hole.
|
|
|
495e37 |
|
|
|
495e37 |
Fixes: 0347a8fd4c3faaedf119be04c197804be40a384b
|
|
|
495e37 |
Suggested-by: Ilya Dryomov <idryomov@gmail.com>
|
|
|
495e37 |
Cc: qemu-stable@nongnu.org
|
|
|
495e37 |
Signed-off-by: Peter Lieven <pl@kamp.de>
|
|
|
495e37 |
Message-Id: <20220113144426.4036493-2-pl@kamp.de>
|
|
|
495e37 |
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
|
|
|
495e37 |
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
495e37 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
495e37 |
(cherry picked from commit 9e302f64bb407a9bb097b626da97228c2654cfee)
|
|
|
495e37 |
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
495e37 |
---
|
|
|
495e37 |
block/rbd.c | 10 +++++-----
|
|
|
495e37 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
495e37 |
|
|
|
495e37 |
diff --git a/block/rbd.c b/block/rbd.c
|
|
|
495e37 |
index def96292e0..20bb896c4a 100644
|
|
|
495e37 |
--- a/block/rbd.c
|
|
|
495e37 |
+++ b/block/rbd.c
|
|
|
495e37 |
@@ -1279,11 +1279,11 @@ static int qemu_rbd_diff_iterate_cb(uint64_t offs, size_t len,
|
|
|
495e37 |
RBDDiffIterateReq *req = opaque;
|
|
|
495e37 |
|
|
|
495e37 |
assert(req->offs + req->bytes <= offs);
|
|
|
495e37 |
- /*
|
|
|
495e37 |
- * we do not diff against a snapshot so we should never receive a callback
|
|
|
495e37 |
- * for a hole.
|
|
|
495e37 |
- */
|
|
|
495e37 |
- assert(exists);
|
|
|
495e37 |
+
|
|
|
495e37 |
+ /* treat a hole like an unallocated area and bail out */
|
|
|
495e37 |
+ if (!exists) {
|
|
|
495e37 |
+ return 0;
|
|
|
495e37 |
+ }
|
|
|
495e37 |
|
|
|
495e37 |
if (!req->exists && offs > req->offs) {
|
|
|
495e37 |
/*
|
|
|
495e37 |
--
|
|
|
495e37 |
2.27.0
|
|
|
495e37 |
|