]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd/migration/NBDStream: be more thorough around nbd_block_status()
authorIlya Dryomov <idryomov@gmail.com>
Sun, 25 Aug 2024 11:10:58 +0000 (13:10 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 21 May 2025 15:27:16 +0000 (17:27 +0200)
commitac8d61a41934dd6d8200d0a827be270a3f3ad69a
tree03361df3bb87a37214e0f69b728d9efd0096491a
parent5a2c11c579f9a3516c8b532f9d2a79ba2990e03e
librbd/migration/NBDStream: be more thorough around nbd_block_status()

nbd_block_status() is specified to be really loose: it can return
more status (go beyond the requested range), less status (cover only
some part of the requested range) or nothing at all.  The former would
likely violate some assumptions in ObjectCopyRequest, while the latter
would lead to straight data corruption -- parent blocks that weren't
covered would never get copied up into the destination image.

On top of that, the current implementation is very suboptimal.
Because only "nr_entries == 2" responses are effectively processed,
any extent which has a small amount of data and is otherwise zeroed
(e.g. 8K of data in a 4M object) gets listed as DATA.  A copyup for
such an object would write 4M worth of data instead of 8K, consuming
space in the destination image unnecessarily.

Also, it's unclear whether zero-sized entries can be returned.
Currently, if it happens we would hit an assert in interval_map.

This fixes all of these issues.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit d52bd80f1f9daed51e1cdac142b07fcb9dec8615)
src/librbd/migration/NBDStream.cc