OSDN Git Service

qemu-img: rebase: stop when reaching EOF of old backing file
authorAndrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Tue, 19 Sep 2023 16:57:57 +0000 (19:57 +0300)
committerKevin Wolf <kwolf@redhat.com>
Tue, 31 Oct 2023 12:51:27 +0000 (13:51 +0100)
commit8b097fd6b06ec295faefd4f30f96f8709abc9605
tree5dd327c0354b37bbc2b8503458af43b1ccb7b2b5
parent516fffc9933cb21fad41ca8f7bf465d238d4d375
qemu-img: rebase: stop when reaching EOF of old backing file

In case when we're rebasing within one backing chain, and when target image
is larger than old backing file, bdrv_is_allocated_above() ends up setting
*pnum = 0.  As a result, target offset isn't getting incremented, and we
get stuck in an infinite for loop.  Let's detect this case and proceed
further down the loop body, as the offsets beyond the old backing size need
to be explicitly zeroed.

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Message-ID: <20230919165804.439110-2-andrey.drobyshev@virtuozzo.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-img.c