On Thu, Jan 13, 2022 at 3:44 PM Peter Lieven <p...@kamp.de> 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. > > Cc: qemu-sta...@nongnu.org > Signed-off-by: Peter Lieven <p...@kamp.de> > --- > block/rbd.c | 42 ++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 40 insertions(+), 2 deletions(-) > > 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 */
Nit: extra space Thanks, Ilya