]> xenbits.xensource.com Git - qemu-upstream-4.6-testing.git/commitdiff
qcow2: Respect bdrv_truncate() error
authorMax Reitz <mreitz@redhat.com>
Tue, 2 Dec 2014 17:32:52 +0000 (18:32 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Sun, 22 Feb 2015 18:09:55 +0000 (12:09 -0600)
bdrv_truncate() may fail and qcow2_write_compressed() should return the
error code in that case.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 6a69b9620ac1562a067990d87284a85552bfd61b)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/qcow2.c

index a33e863372ec2a529d4b4a06e61e0c5a839b861a..c98d3b778825d45ca2b8a020944f6e29371a0c7d 100644 (file)
@@ -2162,8 +2162,7 @@ static int qcow2_write_compressed(BlockDriverState *bs, int64_t sector_num,
         /* align end of file to a sector boundary to ease reading with
            sector based I/Os */
         cluster_offset = bdrv_getlength(bs->file);
-        bdrv_truncate(bs->file, cluster_offset);
-        return 0;
+        return bdrv_truncate(bs->file, cluster_offset);
     }
 
     if (nb_sectors != s->cluster_sectors) {