All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Peter Lieven <pl@kamp.de>
Cc: kwolf@redhat.com, berrange@redhat.com, qemu-block@nongnu.org,
	ct@flyingcircus.io, qemu-stable@nongnu.org,
	qemu-devel@nongnu.org, mreitz@redhat.com, pbonzini@redhat.com,
	idryomov@gmail.com, idryomov@redhat.com, dillaman@redhat.com
Subject: Re: [PATCH V2 for-6.2 2/2] block/rbd: workaround for ceph issue #53784
Date: Mon, 17 Jan 2022 15:23:48 +0100	[thread overview]
Message-ID: <20220117142348.oq3gcr6wsxxo3owa@steredhat> (raw)
In-Reply-To: <20220113144426.4036493-3-pl@kamp.de>

On Thu, Jan 13, 2022 at 03:44:26PM +0100, Peter Lieven wrote:
>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.
>
>This patch works around this bug for pre Quincy versions of librbd.
>

I'm not sure, but maybe we could add the fixes tag also to this patch, 
since without this workaround we can have issues with buggy librbd.

Fixes: 0347a8fd4c3faaedf119be04c197804be40a384b

>Cc: qemu-stable@nongnu.org
>Signed-off-by: Peter Lieven <pl@kamp.de>
>---
> block/rbd.c | 42 ++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 40 insertions(+), 2 deletions(-)

Tested-by: Stefano Garzarella <sgarzare@redhat.com>


>
>diff --git a/block/rbd.c b/block/rbd.c
>index 20bb896c4a..d174d51659 100644
>--- a/block/rbd.c
>+++ b/block/rbd.c
>@@ -1320,6 +1320,7 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs,
>     int status, r;
>     RBDDiffIterateReq req = { .offs = offset };
>     uint64_t features, flags;
>+    uint64_t head = 0;
>
>     assert(offset + bytes <= s->image_size);
>
>@@ -1347,7 +1348,43 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs,
>         return status;
>     }
>
>-    r = rbd_diff_iterate2(s->image, NULL, offset, bytes, true, true,
>+#if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 17, 0)
>+    /*
>+     * 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.
>+     * This is OK because we call rbd_diff_iterate2 with whole_object = true.
>+     * However, this workaround only works for non cloned images with default
>+     * striping.
>+     *
>+     * See: https://tracker.ceph.com/issues/53784
>+     */
>+
>+    /*  check if RBD image has non-default striping enabled */
>+    if (features & RBD_FEATURE_STRIPINGV2) {
>+        return status;
>+    }
>+
>+#pragma GCC diagnostic push
>+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
>+    /*
>+     * check if RBD image is a clone (= has a parent).
>+     *
>+     * rbd_get_parent_info is deprecated from Nautilus onwards, but the
>+     * replacement rbd_get_parent is not present in Luminous and Mimic.
>+     */
>+    if (rbd_get_parent_info(s->image, NULL, 0, NULL, 0, NULL, 0) != -ENOENT) {
>+        return status;
>+    }
>+#pragma GCC diagnostic pop
>+
>+    head = req.offs & (s->object_size - 1);
>+    req.offs -= head;
>+    bytes += head;
>+#endif
>+
>+    r = rbd_diff_iterate2(s->image, NULL, req.offs, bytes, true, true,
>                           qemu_rbd_diff_iterate_cb, &req);
>     if (r < 0 && r != QEMU_RBD_EXIT_DIFF_ITERATE2) {
>         return status;
>@@ -1366,7 +1403,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-17 14:53 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 ` [PATCH V2 for-6.2 1/2] block/rbd: fix handling of holes in .bdrv_co_block_status Peter Lieven
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 [this message]
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=20220117142348.oq3gcr6wsxxo3owa@steredhat \
    --to=sgarzare@redhat.com \
    --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=pl@kamp.de \
    --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.