summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-11-04 02:34:26 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-11-07 20:15:13 -0800
commit9c4777534bdcce46f2391852933336bc73309f93 (patch)
treeae1e855c5dcc778cdb9675cafc124f6bca751a64
parentd19a72024c8cd5e40dc48df27c21fda701e76c54 (diff)
rpc-transport/rdma: create request_context only if message contains read chunks or write chunks.
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1992 (glusterd crashed while submitting a callback.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1992
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index b2258fbb99d..3fae9d795de 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -1001,22 +1001,25 @@ __rdma_ioq_churn_request (rdma_peer_t *peer, rdma_ioq_t *entry,
goto out;
}
- request_ctx = mem_get (priv->device->request_ctx_pool);
- if (request_ctx == NULL) {
- ret = -1;
- gf_log (RDMA_LOG_NAME, GF_LOG_ERROR, "out of memory");
- goto out;
- }
+ if ((wtype != rdma_noch) || (rtype != rdma_noch)) {
+ request_ctx = mem_get (priv->device->request_ctx_pool);
+ if (request_ctx == NULL) {
+ ret = -1;
+ gf_log (RDMA_LOG_NAME, GF_LOG_ERROR, "out of memory");
+ goto out;
+ }
- memset (request_ctx, 0, sizeof (*request_ctx));
+ memset (request_ctx, 0, sizeof (*request_ctx));
- request_ctx->pool = priv->device->request_ctx_pool;
- request_ctx->peer = peer;
+ request_ctx->pool = priv->device->request_ctx_pool;
+ request_ctx->peer = peer;
- entry->msg.request.rpc_req->conn_private = request_ctx;
- if (entry->msg.request.rsp_iobref != NULL) {
- request_ctx->rsp_iobref
- = iobref_ref (entry->msg.request.rsp_iobref);
+ entry->msg.request.rpc_req->conn_private = request_ctx;
+
+ if (entry->msg.request.rsp_iobref != NULL) {
+ request_ctx->rsp_iobref
+ = iobref_ref (entry->msg.request.rsp_iobref);
+ }
}
rpc_msg = (struct rpc_msg *) entry->rpchdr[0].iov_base;
@@ -1095,7 +1098,10 @@ out:
if (ret == -1) {
rpc_req = entry->msg.request.rpc_req;
- __rdma_request_context_destroy (rpc_req->conn_private);
+ if (request_ctx != NULL) {
+ __rdma_request_context_destroy (rpc_req->conn_private);
+ }
+
rpc_req->conn_private = NULL;
}
@@ -3056,11 +3062,15 @@ rdma_pollin_notify (rdma_peer_t *peer, rdma_post_t *post)
rpc_req->conn_private = NULL;
priv = peer->trans->private;
- pthread_mutex_lock (&priv->write_mutex);
- {
- __rdma_request_context_destroy (request_context);
+ if (request_context != NULL) {
+ pthread_mutex_lock (&priv->write_mutex);
+ {
+ __rdma_request_context_destroy (request_context);
+ }
+ pthread_mutex_unlock (&priv->write_mutex);
+ } else {
+ rdma_quota_put (peer);
}
- pthread_mutex_unlock (&priv->write_mutex);
pollin->is_reply = 1;
}