From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIj7U-0003Yn-K1 for qemu-devel@nongnu.org; Sat, 16 Aug 2014 14:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIj7P-0001wC-JS for qemu-devel@nongnu.org; Sat, 16 Aug 2014 14:54:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIj7P-0001vv-As for qemu-devel@nongnu.org; Sat, 16 Aug 2014 14:54:23 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7GIsKXi014315 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 16 Aug 2014 14:54:21 -0400 From: Max Reitz Date: Sat, 16 Aug 2014 20:54:15 +0200 Message-Id: <1408215258-12545-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 0/3] block: Fix is_allocated() for truncated images List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz Patch 2: The bdrv_is_allocated() functions may return a number of zero sectors e.g. if a sector beyond the image end has been queried. Respect this case in qemu-io's map implementation so it doesn't run into an infinite loop (https://bugs.launchpad.net/qemu/+bug/1356969). Patch 1: In that bug report, bdrv_co_get_block_status() fell through to the underlying file to get additional information (whether the sectors are zeroed). However, the offset reported by the image format (qcow2) was beyond the size of the underlying file and so this second query returned only zero clusters which replaced the actual number of sectors queried in the "formatted" (on qcow2 level) image. But because errors from this second call are ignored, the number of sector queried successfully should be ignored as well, which makes qemu-io -c map actually work for that bug report. Patch 3 adds a test for patch 1; I could not conceive a test for patch 2 which patch 1 would not already catch, but patch 2 should be simple enough not to require a test anyway. Thanks to patch 3, this series depends on my previous series "[PATCH v10 00/14] qemu-img: Implement commit like QMP" (strictly speaking only on patch 11 of that series which adds _filter_qemu_img_map() to tests/qemu-iotests/common.filter). Max Reitz (3): block: Ignore allocation size in underlying file qemu-io: Respect early image end for map iotests: Add test for map commands block.c | 6 +++-- qemu-io-cmds.c | 5 +++- tests/qemu-iotests/102 | 64 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/102.out | 11 ++++++++ tests/qemu-iotests/group | 1 + 5 files changed, 84 insertions(+), 3 deletions(-) create mode 100755 tests/qemu-iotests/102 create mode 100644 tests/qemu-iotests/102.out -- 2.0.4