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