Project

General

Profile

Actions

Bug #53784

closed

diff-iterate reports incorrect offsets in fast-diff mode

Added by Ilya Dryomov over 2 years ago. Updated about 2 years ago.

Status:
Resolved
Priority:
Immediate
Assignee:
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
octopus,pacific
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

If rbd_diff_iterate2() is called on an image offset that doesn't correspond to an object boundary, the callback is invoked with an incorrect image offset.

For example, assuming a fully allocated image, a diff request for 806354944~57344 results in offs=807403520, len=57344, exists=true invocation, which is "ahead" by 1048576 bytes (because 806354944 happens to be 1048576 bytes "in" the corresponding object).

This occurs only in fast-diff mode, for a diff request on an image with the fast-diff feature disabled or if whole_object is set to false the invocation is correct.

This bug goes back to the introduction of fast-diff mode in 2015. We didn't see it before because normally diff requests are large and start at object size boundaries, most often at the beginning of the image. However in QEMU 6.2 we started using rbd_diff_iterate2() in fast-diff mode for bdrv_co_block_status reporting and some QEMU block layer configurations can generate a slew of small diff requests that are very likely to start at an arbitrary offset. One example is a local QCOW snapshot layered on top of an RBD image:

$ qemu-img create -f qcow2 -F raw -b rbd:rbd/base snap.qcow2

An incorrect offset reported by rbd_diff_iterate2() is sometimes caught by assert:

qemu-kvm: ../block/rbd.c:1355: int qemu_rbd_co_block_status(BlockDriverState *, _Bool, int64_t, int64_t, int64_t *, int64_t *, BlockDriverState **): Assertion `req.bytes <= bytes' failed.

If not caught, it can result in data corruption in the snapshot.


Related issues 3 (0 open3 closed)

Related to rbd - Bug #53885: diff-iterate in fast-diff mode reports extents out of order for fancy striped imagesResolvedIlya Dryomov

Actions
Copied to rbd - Backport #53839: pacific: diff-iterate reports incorrect offsets in fast-diff modeResolvedCory SnyderActions
Copied to rbd - Backport #53840: octopus: diff-iterate reports incorrect offsets in fast-diff modeResolvedCory SnyderActions
Actions #1

Updated by Ilya Dryomov over 2 years ago

  • Status changed from In Progress to Fix Under Review
  • Pull request ID set to 44483
Actions #2

Updated by Peter Lieven over 2 years ago

I sent a workaround to qemu-devel/qemu-stable: https://lists.gnu.org/archive/html/qemu-devel/2022-01/msg01883.html

Actions #3

Updated by Ilya Dryomov over 2 years ago

  • Status changed from Fix Under Review to Pending Backport
Actions #4

Updated by Backport Bot over 2 years ago

  • Copied to Backport #53839: pacific: diff-iterate reports incorrect offsets in fast-diff mode added
Actions #5

Updated by Backport Bot over 2 years ago

  • Copied to Backport #53840: octopus: diff-iterate reports incorrect offsets in fast-diff mode added
Actions #6

Updated by Ilya Dryomov over 2 years ago

  • Related to Bug #53885: diff-iterate in fast-diff mode reports extents out of order for fancy striped images added
Actions #7

Updated by Loïc Dachary about 2 years ago

  • Status changed from Pending Backport to Resolved

While running with --resolve-parent, the script "backport-create-issue" noticed that all backports of this issue are in status "Resolved" or "Rejected".

Actions

Also available in: Atom PDF