]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd: reduce overlap and respect area when pruning parent extents
authorIlya Dryomov <idryomov@gmail.com>
Sat, 15 Oct 2022 16:31:45 +0000 (18:31 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 4 Dec 2022 17:19:19 +0000 (18:19 +0100)
commitd47bb2a2db0d5e9373137bd454cb31c3cdfc06a4
treefd0d2841768a6b3cfb556c98c3c5961a2b0b7be4
parent0e318952a5c8dfdb7dcc89cf3fa7bad935accfbd
librbd: reduce overlap and respect area when pruning parent extents

DATA area in the parent may be smaller than the part of DATA area in
the clone that is still within the overlap.  This would occur e.g. in
LUKS2-formatted parent + LUKS1-formatted clone case, due to LUKS2
header usually being bigger than LUKS1 header:

parent: raw size = 64M
        LUKS2 header area = 16M
        data area = 48M

clone:  raw size = 64M (raw overlap 64M)
        LUKS1 header area = 4M
        data area = 60M

Currently, because parent extents are pruned only according to raw
overlap (64M), the clone ends up attempting to reach the parent for all
of its data area (60M < 64M) even though the parent only has 48M worth
of data.  All kinds of bugs ensue for 48M..60M offsets and this range
basically becomes inaccessible to the user.

A related issue is that prune_parent_extents() ignores area.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
12 files changed:
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h
src/librbd/cache/ObjectCacherWriteback.cc
src/librbd/deep_copy/ObjectCopyRequest.cc
src/librbd/io/CopyupRequest.cc
src/librbd/io/ObjectRequest.cc
src/librbd/io/Utils.cc
src/test/librbd/crypto/test_mock_CryptoObjectDispatch.cc
src/test/librbd/io/test_mock_CopyupRequest.cc
src/test/librbd/io/test_mock_ObjectRequest.cc
src/test/librbd/mock/MockImageCtx.h
src/test/librbd/test_librbd.cc