From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgVAJ-0001m7-Gz for qemu-devel@nongnu.org; Tue, 21 Oct 2014 04:51:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgVAD-0006Y2-CT for qemu-devel@nongnu.org; Tue, 21 Oct 2014 04:51:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgVAD-0006Xw-5V for qemu-devel@nongnu.org; Tue, 21 Oct 2014 04:51:33 -0400 From: Max Reitz Date: Tue, 21 Oct 2014 10:51:24 +0200 Message-Id: <1413881486-24710-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 0/2] block/vdi: Fix bmap writing error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Weil , Max Reitz , Stefan Hajnoczi , =?UTF-8?q?Beno=C3=AEt=20Canet?= The bmap size in block/vdi.c may exceed INT_MAX. Using bdrv_pwrite_sync() (which takes an int byte count) is therefore not a good idea. The second patch of this series fixes this by replacing bdrv_pwrite_sync() by bdrv_write()+bdrv_flush() (we don't need the p in pwrite here). The first patch employs ROUND_UP() and DIV_ROUND_UP() in block/vdi.c, so you are reminded that bmap_size is aligned to BDRV_SECTOR_SIZE for the second patch. See https://bugzilla.redhat.com/show_bug.cgi?id=1154940 for a bug report. I will not include an iotest in this series because this would require qemu to allocate and then write about 2G of data; yes, test 1 in 084 fails for me because qemu cannot allocate 4G for the bmap. In fact, I can only test this once I'm home where I have more RAM available (I made the mistake of activating swap space to test this only once). Max Reitz (2): block/vdi: Use {DIV_,}ROUND_UP block/vdi: Do not use bdrv_pwrite_sync() for bmap block/vdi.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) -- 1.9.3