]> 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>
Wed, 1 Nov 2023 10:01:33 +0000 (13:01 +0300)
commitbd8d9c618a1921355c94adb6ab07de8540f02f6e
treef7aefdda61e1a23af438edf77ff89f1c42172c6a
parentde18cbdaf21ae64c6b776e16bcc62f63b46a9661
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