summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-02-19 15:52:28 +0530
committerVijay Bellur <vbellur@redhat.com>2015-03-10 19:28:29 -0700
commit219512c5014e9a13081d6a9981ae02b54586d801 (patch)
treed6b6968f1f0abb6a95c4855da8d1971dc6a156c6 /rpc/rpc-transport
parent1a4e7362af1f351f389b73f9ae9c0b1fa423f7a3 (diff)
rdma: Free resources related to iobuf in fini
If rdma transport is destroyed because of any reason, then rdma.so will be unloaded. But we are not setting iobuf registeration function to null. After this, if an iobuf request is came, then we will try to call a function which is not loaded. Change-Id: I3293f9974e16d8e865131785ee697ea02be8cdfc BUG: 1187456 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/9697 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'rpc/rpc-transport')
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c18
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.h1
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;