|
|
9ae3a8 |
From d54fad56d67682c441b6e79a14df9ab9867a7b21 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <d54fad56d67682c441b6e79a14df9ab9867a7b21.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 14 Nov 2013 22:53:12 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 36/46] rdma: clean up of qemu_rdma_cleanup()
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1384469598-13137-37-git-send-email-ncroxon@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55726
|
|
|
9ae3a8 |
O-Subject: [RHEL7.0 PATCH 36/42] rdma: clean up of qemu_rdma_cleanup()
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
>From commit ID:
|
|
|
9ae3a8 |
commit 5a91337cdf343b94474f8bbecab85a8c00f6d2a1
|
|
|
9ae3a8 |
Author: Isaku Yamahata <yamahata@private.email.ne.jp>
|
|
|
9ae3a8 |
Date: Tue Aug 13 11:12:43 2013 +0900
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
rdma: clean up of qemu_rdma_cleanup()
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- It can't be determined by RDMAContext::cm_id != NULL if the connection
|
|
|
9ae3a8 |
is established or not.
|
|
|
9ae3a8 |
- RDMAContext::cm_id is leaked and not destroyed because it is set to NULL
|
|
|
9ae3a8 |
too early.
|
|
|
9ae3a8 |
- RDMAContext::qp is created by rdma_create_qp() so that it should be destroyed
|
|
|
9ae3a8 |
by rdma_destroy_qp(). not ibv_destroy_qp()
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Cc: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
|
|
|
9ae3a8 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
migration-rdma.c | 9 ++++++---
|
|
|
9ae3a8 |
1 files changed, 6 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
migration-rdma.c | 9 ++++++---
|
|
|
9ae3a8 |
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/migration-rdma.c b/migration-rdma.c
|
|
|
9ae3a8 |
index 943496f..be3d984 100644
|
|
|
9ae3a8 |
--- a/migration-rdma.c
|
|
|
9ae3a8 |
+++ b/migration-rdma.c
|
|
|
9ae3a8 |
@@ -356,6 +356,7 @@ typedef struct RDMAContext {
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
struct rdma_cm_id *cm_id; /* connection manager ID */
|
|
|
9ae3a8 |
struct rdma_cm_id *listen_id;
|
|
|
9ae3a8 |
+ bool connected;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
struct ibv_context *verbs;
|
|
|
9ae3a8 |
struct rdma_event_channel *channel;
|
|
|
9ae3a8 |
@@ -2194,7 +2195,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
|
|
|
9ae3a8 |
struct rdma_cm_event *cm_event;
|
|
|
9ae3a8 |
int ret, idx;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (rdma->cm_id) {
|
|
|
9ae3a8 |
+ if (rdma->cm_id && rdma->connected) {
|
|
|
9ae3a8 |
if (rdma->error_state) {
|
|
|
9ae3a8 |
RDMAControlHeader head = { .len = 0,
|
|
|
9ae3a8 |
.type = RDMA_CONTROL_ERROR,
|
|
|
9ae3a8 |
@@ -2213,7 +2214,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
DDPRINTF("Disconnected.\n");
|
|
|
9ae3a8 |
- rdma->cm_id = NULL;
|
|
|
9ae3a8 |
+ rdma->connected = false;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
g_free(rdma->block);
|
|
|
9ae3a8 |
@@ -2235,7 +2236,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (rdma->qp) {
|
|
|
9ae3a8 |
- ibv_destroy_qp(rdma->qp);
|
|
|
9ae3a8 |
+ rdma_destroy_qp(rdma->cm_id);
|
|
|
9ae3a8 |
rdma->qp = NULL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
if (rdma->cq) {
|
|
|
9ae3a8 |
@@ -2372,6 +2373,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
|
|
|
9ae3a8 |
rdma->cm_id = NULL;
|
|
|
9ae3a8 |
goto err_rdma_source_connect;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
+ rdma->connected = true;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
memcpy(&cap, cm_event->param.conn.private_data, sizeof(cap));
|
|
|
9ae3a8 |
network_to_caps(&cap);
|
|
|
9ae3a8 |
@@ -2906,6 +2908,7 @@ static int qemu_rdma_accept(RDMAContext *rdma)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
rdma_ack_cm_event(cm_event);
|
|
|
9ae3a8 |
+ rdma->connected = true;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
ret = qemu_rdma_post_recv_control(rdma, RDMA_WRID_READY);
|
|
|
9ae3a8 |
if (ret) {
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|