summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport/rdma
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-09-17 23:21:55 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-17 23:35:05 -0700
commitd111e0fa0b9769b8ffb8df97a976ba74efae576d (patch)
treefde306b88e56883325322047c97692c6e578aecd /rpc/rpc-transport/rdma
parent0693997b778d1f3c328f0ad0d6ab8b1ad3be6b72 (diff)
rdma: do event_unregister() in fini() too.
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1611 (crash in gf_free) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1611
Diffstat (limited to 'rpc/rpc-transport/rdma')
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 57049967b20..7790971f867 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -4713,6 +4713,8 @@ init (rpc_transport_t *this)
rdma_private_t *priv = NULL;
priv = GF_CALLOC (1, sizeof (*priv), gf_common_mt_rdma_private_t);
+ if (!priv)
+ return -1;
this->private = priv;
priv->sock = -1;
@@ -4726,27 +4728,32 @@ init (rpc_transport_t *this)
return 0;
}
-void
+void
fini (struct rpc_transport *this)
{
/* TODO: verify this function does graceful finish */
rdma_private_t *priv = this->private;
this->private = NULL;
- pthread_mutex_destroy (&priv->recv_mutex);
- pthread_mutex_destroy (&priv->write_mutex);
- pthread_mutex_destroy (&priv->read_mutex);
+ if (priv) {
+ pthread_mutex_destroy (&priv->recv_mutex);
+ pthread_mutex_destroy (&priv->write_mutex);
+ pthread_mutex_destroy (&priv->read_mutex);
- mem_pool_destroy (priv->request_ctx_pool);
- mem_pool_destroy (priv->ioq_pool);
- mem_pool_destroy (priv->reply_info_pool);
+ mem_pool_destroy (priv->request_ctx_pool);
+ mem_pool_destroy (priv->ioq_pool);
+ mem_pool_destroy (priv->reply_info_pool);
- /* pthread_cond_destroy (&priv->recv_cond); */
+ /* pthread_cond_destroy (&priv->recv_cond); */
+ if (priv->sock != -1) {
+ event_unregister (this->ctx->event_pool,
+ priv->sock, priv->idx);
+ }
- gf_log (this->name, GF_LOG_TRACE,
- "called fini on transport: %p",
- this);
- GF_FREE (priv);
+ gf_log (this->name, GF_LOG_TRACE,
+ "called fini on transport: %p", this);
+ GF_FREE (priv);
+ }
return;
}