]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
librbd: remap resize target size if encryption is loaded
authorIlya Dryomov <idryomov@gmail.com>
Thu, 20 Oct 2022 15:25:46 +0000 (17:25 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 4 Dec 2022 17:19:19 +0000 (18:19 +0100)
commit2279ae08f1039a54161f65c951a914199f898ecf
tree8ac73d76a86a9a25b97f1f630728d8c9dc16ead0
parentb3deeb152a9d20d861d17fc0310030ccfd81f2ce
librbd: remap resize target size if encryption is loaded

When encryption is loaded, rbd_get_size() and Image::size() return
"effective" size, but rbd_resize() and Image::resize() continue to take
raw size.  The user has to constantly keep these domains in mind.

Saying that resize must be done without encryption loaded is not an
answer because shrinking a clone that has snapshots involves copying up
objects in the affected range (identical to flattening).  In addition,
even if a clone doesn't have snapshots, shrinking it to a size that
isn't an object boundary is going to involve a copyup for the victim
object as well.

To avoid subtle data corruption on shrink, treat resize operation the
same as flatten operation (including on the CLI).

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
doc/man/8/rbd.rst
src/librbd/Operations.cc
src/test/cli/rbd/help.t
src/test/librbd/test_librbd.cc
src/tools/rbd/action/Resize.cc