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 2/2] block/rbd: workaround for ceph issue #53784
Date: Mon, 10 Jan 2022 12:41:54 +0100	[thread overview]
Message-ID: <20220110114154.3774072-3-pl@kamp.de> (raw)
In-Reply-To: <20220110114154.3774072-1-pl@kamp.de>

librbd had a bug until early 2022 that affected all versions of ceph that
supported fast-diff. This bug results in reporting of incorrect offsets
if the offset parameter to rbd_diff_iterate2 is not object aligned.
Work around this bug by rounding down the offset to object boundaries.

Fixes: https://tracker.ceph.com/issues/53784
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
---
 block/rbd.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/block/rbd.c b/block/rbd.c
index 5e9dc91d81..260cb9f4b4 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -1333,6 +1333,7 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs,
     int status, r;
     RBDDiffIterateReq req = { .offs = offset };
     uint64_t features, flags;
+    int64_t head;
 
     assert(offset + bytes <= s->image_size);
 
@@ -1360,6 +1361,19 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs,
         return status;
     }
 
+    /*
+     * librbd had a bug until early 2022 that affected all versions of ceph that
+     * supported fast-diff. This bug results in reporting of incorrect offsets
+     * if the offset parameter to rbd_diff_iterate2 is not object aligned.
+     * Work around this bug by rounding down the offset to object boundaries.
+     *
+     * See: https://tracker.ceph.com/issues/53784
+     */
+    head = offset & (s->object_size - 1);
+    offset -= head;
+    req.offs -= head;
+    bytes += head;
+
     r = rbd_diff_iterate2(s->image, NULL, offset, bytes, true, true,
                           qemu_rbd_diff_iterate_cb, &req);
     if (r < 0 && r != QEMU_RBD_EXIT_DIFF_ITERATE2) {
@@ -1379,7 +1393,8 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs,
         status = BDRV_BLOCK_ZERO | BDRV_BLOCK_OFFSET_VALID;
     }
 
-    *pnum = req.bytes;
+    assert(req.bytes > head);
+    *pnum = req.bytes - head;
     return status;
 }
 
-- 
2.25.1




  parent reply	other threads:[~2022-01-10 11:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 11:41 [PATCH 0/2] block/rbd: fixes for bdrv_co_block_status Peter Lieven
2022-01-10 11:41 ` [PATCH 1/2] block/rbd: fix handling of holes in .bdrv_co_block_status Peter Lieven
2022-01-12  9:05   ` Ilya Dryomov
2022-01-12 20:39     ` Peter Lieven
2022-01-12 21:02       ` Ilya Dryomov
2022-01-12 21:27         ` Peter Lieven
2022-01-10 11:41 ` Peter Lieven [this message]
2022-01-10 14:18   ` [PATCH 2/2] block/rbd: workaround for ceph issue #53784 Stefano Garzarella
2022-01-11  9:10     ` Peter Lieven
2022-01-11 11:15       ` Stefano Garzarella
2022-01-12  9:59   ` Ilya Dryomov
2022-01-12 11:55     ` Peter Lieven
2022-01-12 12:22       ` Ilya Dryomov

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=20220110114154.3774072-3-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.