]> git.apps.os.sepia.ceph.com Git - ceph-ci.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:56:04 +0000 (12:56 +0100)
commit984b4574302671ca8f98f7f670ae9e180213b181
tree3eee5a751785550fb52e664b122ce1d9c962bbfe
parent29fb251298b58b4517c4b4a3998eb526c9dde6fa
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