Skip to content

Commit

Permalink
migration/channel-block: fix return value for qio_channel_block_{read…
Browse files Browse the repository at this point in the history
…v,writev}

in the error case. The documentation in include/io/channel.h states
that -1 or QIO_CHANNEL_ERR_BLOCK should be returned upon error. Simply
passing along the return value from the bdrv-functions has the
potential to confuse the call sides. Non-blocking mode is not
implemented currently, so -1 it is.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
  • Loading branch information
foxmox authored and Juan Quintela committed Nov 15, 2022
1 parent 98f10f0 commit 23bb4ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions migration/channel-block.c
Expand Up @@ -62,7 +62,8 @@ qio_channel_block_readv(QIOChannel *ioc,
qemu_iovec_init_external(&qiov, (struct iovec *)iov, niov);
ret = bdrv_readv_vmstate(bioc->bs, &qiov, bioc->offset);
if (ret < 0) {
return ret;
error_setg_errno(errp, -ret, "bdrv_readv_vmstate failed");
return -1;
}

bioc->offset += qiov.size;
Expand All @@ -86,7 +87,8 @@ qio_channel_block_writev(QIOChannel *ioc,
qemu_iovec_init_external(&qiov, (struct iovec *)iov, niov);
ret = bdrv_writev_vmstate(bioc->bs, &qiov, bioc->offset);
if (ret < 0) {
return ret;
error_setg_errno(errp, -ret, "bdrv_writev_vmstate failed");
return -1;
}

bioc->offset += qiov.size;
Expand Down

0 comments on commit 23bb4ae

Please sign in to comment.