migration/rdma: Silence qemu_rdma_block_for_wrid()
Functions that use an Error **errp parameter to return errors should not also report them to the user, because reporting is the caller's job. When the caller does, the error is reported twice. When it doesn't (because it recovered from the error), there is no error to report, i.e. the report is bogus. qemu_rdma_post_send_control(), qemu_rdma_exchange_get_response(), and qemu_rdma_write_one() violate this principle: they call error_report(), fprintf(stderr, ...), and perror() via qemu_rdma_block_for_wrid(), qemu_rdma_poll(), and qemu_rdma_wait_comp_channel(). I elected not to investigate how callers handle the error, i.e. precise impact is not known. Clean this up by dropping the error reporting from qemu_rdma_poll(), qemu_rdma_wait_comp_channel(), and qemu_rdma_block_for_wrid(). I believe the callers' error reports suffice. If they don't, we need to convert to Error instead. Bonus: resolves a FIXME about problematic use of errno. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Li Zhijian <lizhijian@fujitsu.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-ID: <20230928132019.2544702-50-armbru@redhat.com>
This commit is contained in:
parent
8dee156c1d
commit
7555c7713d
@ -1483,17 +1483,12 @@ static int qemu_rdma_poll(RDMAContext *rdma, struct ibv_cq *cq,
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
error_report("ibv_poll_cq failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
wr_id = wc.wr_id & RDMA_WRID_TYPE_MASK;
|
||||
|
||||
if (wc.status != IBV_WC_SUCCESS) {
|
||||
fprintf(stderr, "ibv_poll_cq wc.status=%d %s!\n",
|
||||
wc.status, ibv_wc_status_str(wc.status));
|
||||
fprintf(stderr, "ibv_poll_cq wrid=%" PRIu64 "!\n", wr_id);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1577,16 +1572,12 @@ static int qemu_rdma_wait_comp_channel(RDMAContext *rdma,
|
||||
if (pfds[1].revents) {
|
||||
ret = rdma_get_cm_event(rdma->channel, &cm_event);
|
||||
if (ret < 0) {
|
||||
error_report("failed to get cm event while wait "
|
||||
"completion channel");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cm_event->event == RDMA_CM_EVENT_DISCONNECTED ||
|
||||
cm_event->event == RDMA_CM_EVENT_DEVICE_REMOVAL) {
|
||||
rdma_ack_cm_event(cm_event);
|
||||
error_report("receive cm event while wait comp channel,"
|
||||
"cm event is %d", cm_event->event);
|
||||
return -1;
|
||||
}
|
||||
rdma_ack_cm_event(cm_event);
|
||||
@ -1599,7 +1590,6 @@ static int qemu_rdma_wait_comp_channel(RDMAContext *rdma,
|
||||
default: /* Error of some type -
|
||||
* I don't trust errno from qemu_poll_ns
|
||||
*/
|
||||
error_report("%s: poll failed", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1683,12 +1673,6 @@ static int qemu_rdma_block_for_wrid(RDMAContext *rdma,
|
||||
|
||||
ret = ibv_get_cq_event(ch, &cq, &cq_ctx);
|
||||
if (ret < 0) {
|
||||
/*
|
||||
* FIXME perror() is problematic, because ibv_reg_mr() is
|
||||
* not documented to set errno. Will go away later in
|
||||
* this series.
|
||||
*/
|
||||
perror("ibv_get_cq_event");
|
||||
goto err_block_for_wrid;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user