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