aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>2010-07-20 18:19:00 +0900
committerKevin Wolf <kwolf@redhat.com>2010-07-26 13:39:39 +0200
commitb02bea3a85cc939f09aa674a3f1e4f36d418c007 (patch)
tree419ca89ad1df9d40015bb4e3c1a20596ca6f226f
parent253cb7b9909806b83d73269afb9cf0ab3fa2ce2c (diff)
block migration: propagate return value when bdrv_write() returns < 0
Currently block_load() doesn't check return value of bdrv_write(), and even the destination weren't prepared to execute block migration, it proceeds and guest boots on the target. This patch fix this issue. Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block-migration.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block-migration.c b/block-migration.c
index a77106e25c..8eda307d7f 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -586,6 +586,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
addr >>= BDRV_SECTOR_BITS;
if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) {
+ int ret;
/* get device name */
len = qemu_get_byte(f);
qemu_get_buffer(f, (uint8_t *)device_name, len);
@@ -601,9 +602,12 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
buf = qemu_malloc(BLOCK_SIZE);
qemu_get_buffer(f, buf, BLOCK_SIZE);
- bdrv_write(bs, addr, buf, BDRV_SECTORS_PER_DIRTY_CHUNK);
+ ret = bdrv_write(bs, addr, buf, BDRV_SECTORS_PER_DIRTY_CHUNK);
qemu_free(buf);
+ if (ret < 0) {
+ return ret;
+ }
} else if (flags & BLK_MIG_FLAG_PROGRESS) {
if (!banner_printed) {
printf("Receiving block device images\n");