]> git.ipfire.org Git - thirdparty/qemu.git/commit
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)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 2 Nov 2023 12:04:24 +0000 (15:04 +0300)
commit1e67bd7c217eac41518b752074125be89f70b81d
tree1635230e4df1ccc2bb162cb15135cfe0b1e3440d
parent6367e823caead19cfbe5ba0724a93691b65c257d
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>
(cherry picked from commit 8b097fd6b06ec295faefd4f30f96f8709abc9605)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
qemu-img.c