[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 21/30] migration/rdma: fix return value for qio_channel_rdma_{read
From: |
Juan Quintela |
Subject: |
[PULL 21/30] migration/rdma: fix return value for qio_channel_rdma_{readv, writev} |
Date: |
Tue, 7 Feb 2023 01:56:41 +0100 |
From: Fiona Ebner <f.ebner@proxmox.com>
upon errors. As the documentation in include/io/channel.h states, only
-1 and QIO_CHANNEL_ERR_BLOCK should be returned upon error. Other
values have the potential to confuse the call sites.
error_setg is used rather than error_setg_errno, because there are
certain code paths where -1 (as a non-errno) is propagated up (e.g.
starting from qemu_rdma_block_for_wrid or qemu_rdma_post_recv_control)
all the way to qio_channel_rdma_{readv,writev}.
Similar to a216ec85b7 ("migration/channel-block: fix return value for
qio_channel_block_{readv,writev}").
Suggested-by: Zhang Chen <chen.zhang@intel.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/rdma.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index 94a55dd95b..0ba1668d70 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -2785,7 +2785,8 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *ioc,
rdma = qatomic_rcu_read(&rioc->rdmaout);
if (!rdma) {
- return -EIO;
+ error_setg(errp, "RDMA control channel output is not set");
+ return -1;
}
CHECK_ERROR_STATE();
@@ -2797,7 +2798,8 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *ioc,
ret = qemu_rdma_write_flush(f, rdma);
if (ret < 0) {
rdma->error_state = ret;
- return ret;
+ error_setg(errp, "qemu_rdma_write_flush returned %d", ret);
+ return -1;
}
for (i = 0; i < niov; i++) {
@@ -2816,7 +2818,8 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *ioc,
if (ret < 0) {
rdma->error_state = ret;
- return ret;
+ error_setg(errp, "qemu_rdma_exchange_send returned %d", ret);
+ return -1;
}
data += len;
@@ -2867,7 +2870,8 @@ static ssize_t qio_channel_rdma_readv(QIOChannel *ioc,
rdma = qatomic_rcu_read(&rioc->rdmain);
if (!rdma) {
- return -EIO;
+ error_setg(errp, "RDMA control channel input is not set");
+ return -1;
}
CHECK_ERROR_STATE();
@@ -2903,7 +2907,8 @@ static ssize_t qio_channel_rdma_readv(QIOChannel *ioc,
if (ret < 0) {
rdma->error_state = ret;
- return ret;
+ error_setg(errp, "qemu_rdma_exchange_recv returned %d", ret);
+ return -1;
}
/*
--
2.39.1
- [PULL 11/30] migration/ram: Optimize ram_write_tracking_start() for RamDiscardManager, (continued)
- [PULL 11/30] migration/ram: Optimize ram_write_tracking_start() for RamDiscardManager, Juan Quintela, 2023/02/06
- [PULL 13/30] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup(), Juan Quintela, 2023/02/06
- [PULL 12/30] migration/savevm: Move more savevm handling into vmstate_save(), Juan Quintela, 2023/02/06
- [PULL 14/30] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Juan Quintela, 2023/02/06
- [PULL 16/30] migration/ram: Factor out check for advised postcopy, Juan Quintela, 2023/02/06
- [PULL 15/30] migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and VMSTATE_BITMAP_TEST(), Juan Quintela, 2023/02/06
- [PULL 17/30] virtio-mem: Fail if a memory backend with "prealloc=on" is specified, Juan Quintela, 2023/02/06
- [PULL 18/30] virtio-mem: Migrate immutable properties early, Juan Quintela, 2023/02/06
- [PULL 19/30] virtio-mem: Proper support for preallocation with migration, Juan Quintela, 2023/02/06
- [PULL 20/30] migration: Show downtime during postcopy phase, Juan Quintela, 2023/02/06
- [PULL 21/30] migration/rdma: fix return value for qio_channel_rdma_{readv, writev},
Juan Quintela <=
- [PULL 22/30] migration: Add canary to VMSTATE_END_OF_LIST, Juan Quintela, 2023/02/06
- [PULL 23/30] migration: Perform vmsd structure check during tests, Juan Quintela, 2023/02/06
- [PULL 24/30] migration/dirtyrate: Show sample pages only in page-sampling mode, Juan Quintela, 2023/02/06
- [PULL 25/30] io: Add support for MSG_PEEK for socket channel, Juan Quintela, 2023/02/06
- [PULL 27/30] multifd: Fix a race on reading MultiFDPages_t.block, Juan Quintela, 2023/02/06
- [PULL 28/30] multifd: Fix flush of zero copy page send request, Juan Quintela, 2023/02/06
- [PULL 26/30] migration: check magic value for deciding the mapping of channels, Juan Quintela, 2023/02/06
- [PULL 29/30] migration: Introduce interface query-migrationthreads, Juan Quintela, 2023/02/06