From 605ff4691cc265c5459d77305ef6df777a94ee8f Mon Sep 17 00:00:00 2001 From: Mohammed Rafi KC Date: Wed, 5 Aug 2015 12:07:48 +0530 Subject: rdma:restore device linked list structure in case of failure We maintain a linked list strcture to store device information, and maintain head in a ctx variable. A new device will be added at the beginning of list. But if the device creation failed, then we need to adjust the linked list to proper state. back port of : >Change-Id: I07cefd3b808d8973a915728b3ba7f2955d29c92a >BUG: 1250297 >Signed-off-by: Mohammed Rafi KC >Reviewed-on: http://review.gluster.org/11829 >Tested-by: NetBSD Build System >Tested-by: Gluster Build System >Reviewed-by: Raghavendra G (cherry picked from commit 7641eb8b469a6dd4db6db59d2a5ef4d5a65e1a61) Change-Id: I5e7bcdef9402c11a139db8047ae2a9a18cdd8f4e BUG: 1254430 Signed-off-by: Mohammed Rafi KC Reviewed-on: http://review.gluster.org/11943 CentOS-regression: Gluster Build System Smoke: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Raghavendra G --- rpc/rpc-transport/rdma/src/rdma.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'rpc') diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index 34972deef09..b2c1516c56c 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -721,6 +721,10 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, } priv->device = trav; trav->context = ibctx; + + trav->next = rdma_ctx->device; + rdma_ctx->device = trav; + iobuf_pool->device[iobuf_pool->rdma_device_count] = trav; iobuf_pool->mr_list[iobuf_pool->rdma_device_count++] = &trav->all_mr; trav->request_ctx_pool @@ -744,9 +748,6 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, trav->device_name = gf_strdup (device_name); - trav->next = rdma_ctx->device; - rdma_ctx->device = trav; - trav->send_chan = ibv_create_comp_channel (trav->context); if (!trav->send_chan) { gf_msg (this->name, GF_LOG_ERROR, 0, @@ -863,6 +864,7 @@ gf_rdma_get_device (rpc_transport_t *this, struct ibv_context *ibctx, out: if (trav != NULL) { + rdma_ctx->device = trav->next; gf_rdma_destroy_posts (this); mem_pool_destroy (trav->ioq_pool); mem_pool_destroy (trav->request_ctx_pool); -- cgit