diff options
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-transport/rdma/src/rdma.c | 18 | ||||
-rw-r--r-- | rpc/rpc-transport/rdma/src/rdma.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index 22eb0906619..481621e9ca6 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -4746,6 +4746,7 @@ int32_t init (rpc_transport_t *this) { gf_rdma_private_t *priv = NULL; + gf_rdma_ctx_t *rdma_ctx = NULL; struct iobuf_pool *iobuf_pool = NULL; priv = GF_CALLOC (1, sizeof (*priv), gf_common_mt_rdma_private_t); @@ -4761,6 +4762,10 @@ init (rpc_transport_t *this) GF_FREE (priv); return -1; } + rdma_ctx = this->ctx->ib; + if (rdma_ctx != NULL) { + rdma_ctx->dlcount++; + } iobuf_pool = this->ctx->iobuf_pool; iobuf_pool->rdma_registration = gf_rdma_register_arena; iobuf_pool->rdma_deregistration = gf_rdma_deregister_arena; @@ -4773,6 +4778,8 @@ fini (struct rpc_transport *this) { /* TODO: verify this function does graceful finish */ gf_rdma_private_t *priv = NULL; + struct iobuf_pool *iobuf_pool = NULL; + gf_rdma_ctx_t *rdma_ctx = NULL; priv = this->private; @@ -4786,6 +4793,17 @@ fini (struct rpc_transport *this) "called fini on transport: %p", this); GF_FREE (priv); } + + rdma_ctx = this->ctx->ib; + if (!rdma_ctx) + return; + + rdma_ctx->dlcount--; + if (rdma_ctx->dlcount == 0) { + iobuf_pool = this->ctx->iobuf_pool; + iobuf_pool->rdma_registration = NULL; + iobuf_pool->rdma_deregistration = NULL; + } return; } diff --git a/rpc/rpc-transport/rdma/src/rdma.h b/rpc/rpc-transport/rdma/src/rdma.h index fda01aa53ef..0a9fd35a0b1 100644 --- a/rpc/rpc-transport/rdma/src/rdma.h +++ b/rpc/rpc-transport/rdma/src/rdma.h @@ -345,6 +345,7 @@ struct __gf_rdma_ctx { gf_rdma_device_t *device; struct rdma_event_channel *rdma_cm_event_channel; pthread_t rdma_cm_thread; + int32_t dlcount; }; typedef struct __gf_rdma_ctx gf_rdma_ctx_t; |