[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/10] block/rbd: fix handling of holes in .bdrv_co_block_status
From: |
Kevin Wolf |
Subject: |
[PULL 09/10] block/rbd: fix handling of holes in .bdrv_co_block_status |
Date: |
Tue, 1 Feb 2022 16:21:07 +0100 |
From: Peter Lieven <pl@kamp.de>
the assumption that we can't hit a hole if we do not diff against a snapshot
was wrong.
We can see a hole in an image if we diff against base if there exists an older
snapshot
of the image and we have discarded blocks in the image where the snapshot has
data.
Fix this by simply handling a hole like an unallocated area. There are no
callbacks
for unallocated areas so just bail out if we hit a hole.
Fixes: 0347a8fd4c3faaedf119be04c197804be40a384b
Suggested-by: Ilya Dryomov <idryomov@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Message-Id: <20220113144426.4036493-2-pl@kamp.de>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/rbd.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/block/rbd.c b/block/rbd.c
index def96292e0..20bb896c4a 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -1279,11 +1279,11 @@ static int qemu_rbd_diff_iterate_cb(uint64_t offs,
size_t len,
RBDDiffIterateReq *req = opaque;
assert(req->offs + req->bytes <= offs);
- /*
- * we do not diff against a snapshot so we should never receive a callback
- * for a hole.
- */
- assert(exists);
+
+ /* treat a hole like an unallocated area and bail out */
+ if (!exists) {
+ return 0;
+ }
if (!req->exists && offs > req->offs) {
/*
--
2.31.1
- [PULL 00/10] Block layer patches, Kevin Wolf, 2022/02/01
- [PULL 02/10] block: bdrv_set_backing_hd(): use drained section, Kevin Wolf, 2022/02/01
- [PULL 03/10] block/export: Fix vhost-user-blk shutdown with requests in flight, Kevin Wolf, 2022/02/01
- [PULL 04/10] block/export/fuse: Rearrange if-else-if ladder in fuse_fallocate(), Kevin Wolf, 2022/02/01
- [PULL 05/10] block/export/fuse: Fix build failure on FreeBSD, Kevin Wolf, 2022/02/01
- [PULL 07/10] qsd: Document fuse's allow-other option, Kevin Wolf, 2022/02/01
- [PULL 08/10] qemu-img: Unify [-b [-F]] documentation, Kevin Wolf, 2022/02/01
- [PULL 01/10] qemu-storage-daemon: Fix typo in vhost-user-blk help, Kevin Wolf, 2022/02/01
- [PULL 10/10] block/rbd: workaround for ceph issue #53784, Kevin Wolf, 2022/02/01
- [PULL 09/10] block/rbd: fix handling of holes in .bdrv_co_block_status,
Kevin Wolf <=
- [PULL 06/10] block.h: remove outdated comment, Kevin Wolf, 2022/02/01
- Re: [PULL 00/10] Block layer patches, Peter Maydell, 2022/02/02