@@ -429,6 +429,9 @@ void multifd_save_cleanup(void)
g_free(p->packet);
p->packet = NULL;
if (migrate_use_rdma()) {
+ p->rdma->listen_id = NULL;
+ p->rdma->channel = NULL;
+ qemu_rdma_cleanup(p->rdma);
g_free(p->rdma);
}
}
@@ -835,6 +838,9 @@ int multifd_load_cleanup(Error **errp)
g_free(p->packet);
p->packet = NULL;
if (migrate_use_rdma()) {
+ p->rdma->listen_id = NULL;
+ p->rdma->channel = NULL;
+ qemu_rdma_cleanup(p->rdma);
g_free(p->rdma);
}
}
@@ -2096,11 +2096,11 @@ static int qemu_rdma_write(QEMUFile *f, RDMAContext *rdma,
return 0;
}
-static void qemu_rdma_cleanup(RDMAContext *rdma)
+void qemu_rdma_cleanup(RDMAContext *rdma)
{
int idx;
- if (rdma->cm_id && rdma->connected) {
+ if (rdma->channel && rdma->cm_id && rdma->connected) {
if ((rdma->error_state ||
migrate_get_current()->state == MIGRATION_STATUS_CANCELLING) &&
!rdma->received_error) {
@@ -2181,7 +2181,6 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
rdma->host = NULL;
}
-
static int qemu_rdma_source_init(RDMAContext *rdma, bool pin_all, Error **errp)
{
int ret, idx;
@@ -283,6 +283,7 @@ int qemu_rdma_exchange_send(RDMAContext *rdma, RDMAControlHeader *head,
int qemu_rdma_registration(void *opaque);
int qemu_rdma_block_for_wrid(RDMAContext *rdma, int wrid_requested,
uint32_t *byte_len);
+void qemu_rdma_cleanup(RDMAContext *rdma);
void rdma_start_outgoing_migration(void *opaque, const char *host_port,
Error **errp);
Signed-off-by: Zhimin Feng <fengzhimin1@huawei.com> --- migration/multifd.c | 6 ++++++ migration/rdma.c | 5 ++--- migration/rdma.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-)