From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1HbD-0005KA-LD for qemu-devel@nongnu.org; Fri, 01 Feb 2013 09:28:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1HbA-0000U3-RR for qemu-devel@nongnu.org; Fri, 01 Feb 2013 09:28:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1HbA-0000Tv-JQ for qemu-devel@nongnu.org; Fri, 01 Feb 2013 09:28:12 -0500 From: Stefan Hajnoczi Date: Fri, 1 Feb 2013 15:27:53 +0100 Message-Id: <1359728884-19422-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1359728884-19422-1-git-send-email-stefanha@redhat.com> References: <1359728884-19422-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 02/13] block: Fix is_allocated_above with resized files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Vishvananda Ishaya , Stefan Hajnoczi From: Vishvananda Ishaya In an image chain, if the base image is smaller than the current image, we need to make sure to use the current images count of unallocated blocks once we get to the end of the base image. Without this change the code will return 0 blocks when it gets to the end of the base image and mirror_run will fail its assertion. Signed-off-by: Vishvananda Ishaya Signed-off-by: Stefan Hajnoczi --- block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index ba67c0d..50dab8e 100644 --- a/block.c +++ b/block.c @@ -2800,7 +2800,9 @@ int coroutine_fn bdrv_co_is_allocated_above(BlockDriverState *top, * * [sector_num+x, nr_sectors] allocated. */ - if (n > pnum_inter) { + if (n > pnum_inter && + (intermediate == top || + sector_num + pnum_inter < intermediate->total_sectors)) { n = pnum_inter; } -- 1.8.1