]> 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>
Sat, 2 Dec 2023 12:50:04 +0000 (13:50 +0100)
commit8f86d80614680afecbfe82b2a6e965678a3c6034
tree526851317194ca567718bcfde2bfee7cfb3a6335
parentbd52297a71100dd35874fa3aeda81fca1d828b38
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>
src/librbd/io/ObjectRequest.cc
src/test/librbd/io/test_mock_ObjectRequest.cc