Skip to content

quincy: librbd: make diff-iterate in fast-diff mode aware of encryption - #58342

Merged
idryomov merged 3 commits into
ceph:quincyfrom
idryomov:wip-66570-quincy
Jul 13, 2024
Merged

idryomov merged 3 commits into
ceph:quincyfrom
idryomov:wip-66570-quincy

Conversation

@idryomov

Copy link
Copy Markdown
Contributor

@idryomov idryomov added this to the v17.2.8 milestone Jun 28, 2024
@idryomov
idryomov requested a review from a team as a code owner June 28, 2024 12:26
@idryomov

Copy link
Copy Markdown
Contributor Author

Temporarily based on #58210 to avoid conflicts in src/test/librbd/test_librbd.cc.

@idryomov

Copy link
Copy Markdown
Contributor Author

Conflicts:
src/test/librbd/test_librbd.cc [ commit https://github.com/idryomov/ceph/commit/4a5a0a5dd82be9266064631dfee352a96e4061ca ("librbd:
add cloned images encryption API") not in quincy

Sigh, I forgot that ImageArea support isn't in quincy either. The fix would essentially need to be rewritten from scratch...

I'll try to look into it, but might choose leaving this unfixed in quincy given that it's almost EOL.

@idryomov idryomov modified the milestones: v17.2.8, quincy Jun 28, 2024
@idryomov
idryomov marked this pull request as draft June 28, 2024 18:24
@idryomov
idryomov force-pushed the wip-66570-quincy branch from 8f2a713 to 01ed47a Compare July 3, 2024 08:54
@idryomov

idryomov commented Jul 3, 2024

Copy link
Copy Markdown
Contributor Author

Sigh, I forgot that ImageArea support isn't in quincy either. The fix would essentially need to be rewritten from scratch...

This turned out easier that I thought it would be due to the fact that diff-iterate only needs the area -> raw mapping.

@idryomov
idryomov marked this pull request as ready for review July 3, 2024 08:57
@idryomov

idryomov commented Jul 3, 2024

Copy link
Copy Markdown
Contributor Author

jenkins test api

@yuriw

yuriw commented Jul 12, 2024

Copy link
Copy Markdown
Contributor

idryomov added 3 commits July 12, 2024 23:02
In preparation for extending coverage, extract test logic into a couple
of parametrized helpers.

Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit 1df8799)
Currently we are laying data only at the beginning of an object.
Extend the skeletons to write to three different offsets in the middle
and also at the end of the object.

Separately, make C and C++ API test variants slightly different in
terms of offsets being targeted to not go through exactly the same
scenario twice.

Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit da69d1f)
diff-iterate wasn't updated when librbd was being prepared to support
encryption in commit 8d6a479 ("librbd: add crypto image dispatch
layer").  This is even noted in [1]:

> The two places I skipped for now are DiffIterate and TrimRequest.

CryptoImageDispatch has since been removed, but diff-iterate in
fast-diff mode is still unaware of encryption and just assumes that all
offsets are raw.  This means that the callback gets invoked with
incorrect image offsets when encryption is loaded.  For example, for
a LUKS1-formatted image with some data at offsets 0 and 20971520,
diff-iterate with encryption loaded reports

  0~4194304
  4194304~4194304
  25165824~4194304

instead of

  0~4194304
  20971520~4194304

as "exists".  For any piece of code that is using diff-iterate to
optimize block-by-block processing (e.g. copy an encrypted source image
to a differently-encrypted destination image), this is fatal: it would
skip processing block 20971520 which has data and instead process block
25165824 which doesn't have any data and was to be skipped, producing
a corrupted destination image.

[1] ceph#37935 (comment)

Fixes: https://tracker.ceph.com/issues/66570
Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit cdeb0ef)

Conflicts:
	src/librbd/api/DiffIterate.cc [ ImageArea support not in
	  quincy ]
	src/test/librbd/test_librbd.cc [ commit 4a5a0a5 ("librbd:
	  add cloned images encryption API") not in quincy
@idryomov

Copy link
Copy Markdown
Contributor Author

Rebased after #58210 merged.

@idryomov

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@idryomov

Copy link
Copy Markdown
Contributor Author

@idryomov
idryomov merged commit 10b0f85 into ceph:quincy Jul 13, 2024
@idryomov
idryomov deleted the wip-66570-quincy branch July 13, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants