All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, idryomov@redhat.com, berrange@redhat.com,
	qemu-stable@nongnu.org, Peter Lieven <pl@kamp.de>,
	qemu-devel@nongnu.org, ct@flyingcircus.io, pbonzini@redhat.com,
	idryomov@gmail.com, mreitz@redhat.com, dillaman@redhat.com
Subject: [PATCH V2 for-6.2 1/2] block/rbd: fix handling of holes in .bdrv_co_block_status
Date: Thu, 13 Jan 2022 15:44:25 +0100	[thread overview]
Message-ID: <20220113144426.4036493-2-pl@kamp.de> (raw)
In-Reply-To: <20220113144426.4036493-1-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>
---
 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.25.1




  reply	other threads:[~2022-01-13 14:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 14:44 [PATCH V2 for-6.2 0/2] fixes for bdrv_co_block_status Peter Lieven
2022-01-13 14:44 ` Peter Lieven [this message]
2022-01-13 14:44 ` [PATCH V2 for-6.2 2/2] block/rbd: workaround for ceph issue #53784 Peter Lieven
2022-01-14 10:57   ` Ilya Dryomov
2022-01-17 14:23   ` Stefano Garzarella
2022-01-14 10:58 ` [PATCH V2 for-6.2 0/2] fixes for bdrv_co_block_status Ilya Dryomov
2022-01-19 14:57   ` Stefano Garzarella
2022-01-20  9:19     ` Peter Lieven
2022-01-25 10:09       ` Stefano Garzarella
2022-02-01 14:39 ` Kevin Wolf
2022-02-03 11:42   ` Peter Lieven
2022-02-03 12:14     ` Stefano Garzarella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220113144426.4036493-2-pl@kamp.de \
    --to=pl@kamp.de \
    --cc=berrange@redhat.com \
    --cc=ct@flyingcircus.io \
    --cc=dillaman@redhat.com \
    --cc=idryomov@gmail.com \
    --cc=idryomov@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.