Skip to content

Commit

Permalink
block migration: propagate return value when bdrv_write() returns < 0
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yoshiaki Tamura authored and kevmw committed Jul 26, 2010
1 parent 253cb7b commit b02bea3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion block-migration.c
Expand Up @@ -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);
Expand All @@ -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");
Expand Down

0 comments on commit b02bea3

Please sign in to comment.