Use the rdma_cm_id from CMINFO rather than from the event

in cm_close, the rdma_cm_id from dev->cm is used to close the connection
for both the server and the client. However, in cm_open_server the id
from the cm event is used. The pointer for the qp seems to change for
the event's id and causes a segfault in rdma_destroy_qp on the server
side.
master
Henry Estela 2017-09-26 16:24:58 -07:00 committed by Henry Estela
parent d47019ddc4
commit 83bc16e5fc
1 changed files with 4 additions and 3 deletions

View File

@ -1879,7 +1879,8 @@ cm_open_server(DEVICE *dev)
if (rdma_listen(cm->id, 0) != 0)
error(0, "rdma_listen failed");
cm_expect_event(dev, RDMA_CM_EVENT_CONNECT_REQUEST);
rd_create_qp(dev, cm->event->id->verbs, cm->event->id);
cm->id = cm->event->id;
rd_create_qp(dev, cm->id->verbs, cm->id);
if (dev->trans == IBV_QPT_RC) {
struct rdma_conn_param param ={
@ -1892,7 +1893,7 @@ cm_open_server(DEVICE *dev)
.min_rnr_timer = MIN_RNR_TIMER,
};
if (rdma_accept(cm->event->id, &param) != 0)
if (rdma_accept(cm->id, &param) != 0)
error(0, "rdma_accept failed");
cm_ack_event(dev);
cm_expect_event(dev, RDMA_CM_EVENT_ESTABLISHED);
@ -1905,7 +1906,7 @@ cm_open_server(DEVICE *dev)
.qp_num = cm->event->id->qp->qp_num
};
if (rdma_accept(cm->event->id, &param) != 0)
if (rdma_accept(cm->id, &param) != 0)
error(0, "rdma_accept failed");
dev->qkey = cm->event->param.ud.qkey;
dev->ah = ibv_create_ah(dev->pd, &cm->event->param.ud.ah_attr);