]> git.ipfire.org Git - thirdparty/qemu.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>
Wed, 14 Jan 2015 23:08:42 +0000 (17:08 -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)

Conflicts:
block/qcow2.c

*removed context dependency on 75d3d21

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/qcow2.c

index e3cc23c6d2acb37d3614c1cc726063370bfdcd13..d53f18182915502925765e5ee12b6d33b7a6c44d 100644 (file)
@@ -1960,8 +1960,7 @@ static int qcow2_write_compressed(BlockDriverState *bs, int64_t sector_num,
            sector based I/Os */
         cluster_offset = bdrv_getlength(bs->file);
         cluster_offset = (cluster_offset + 511) & ~511;
-        bdrv_truncate(bs->file, cluster_offset);
-        return 0;
+        return bdrv_truncate(bs->file, cluster_offset);
     }
 
     if (nb_sectors != s->cluster_sectors) {