]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd: fix LIST_SNAPS_FLAG_WHOLE_OBJECT behavior
authorIlya Dryomov <idryomov@gmail.com>
Mon, 27 Nov 2023 09:11:52 +0000 (10:11 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 11 Dec 2023 11:44:44 +0000 (12:44 +0100)
commit10a45d3a5e17e811f5737dad2ffcf18a2f3dcbae
tree945d96606f7305e88be49ecf5f68f0d57690c05c
parent06fedbffe3d0e978ab49a12b11e3be4b41c4962b
librbd: fix LIST_SNAPS_FLAG_WHOLE_OBJECT behavior

Bundling read_whole_object and LIST_SNAPS_FLAG_WHOLE_OBJECT cases
together is wrong:

- In read_whole_object case, calc_snap_set_diff() sets just
  read_whole_object.  Everything else is zeroed out and may require
  resetting to fit with the rest of ObjectListSnapsRequest logic.

- In LIST_SNAPS_FLAG_WHOLE_OBJECT case, only the diff should be
  expanded.  Everything else is set by calc_snap_set_diff() and should
  be used as is.  This goes for end_size in particular -- if it's reset
  to object size, bogus zero extents may be returned as the object
  would appear to have grown.

This is a regression introduced in commit 4429ed4f3f4c ("librbd: switch
diff iterate API to use new snaps list dispatch methods") by way of
commit 66dd53d9c4d9 ("librbd: optionally return full object extent for
any snapshot deltas").

Fixes: https://tracker.ceph.com/issues/63654
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 8f86d80614680afecbfe82b2a6e965678a3c6034)
src/librbd/io/ObjectRequest.cc
src/test/librbd/io/test_mock_ObjectRequest.cc