]> git-server-git.apps.pok.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:51:54 +0000 (12:51 +0100)
commit2e7c426539e01aa59c297218e193af803e0653fb
treee497d630eb7aa4dfed1bae49016e4391449aaeef
parentc72a0faa636251d3816d77a7d197412d04dd443e
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