summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2011-08-12 00:46:50 +0530
committerAnand Avati <avati@gluster.com>2011-08-17 21:01:56 -0700
commitcef6d3596fcbda71c19e66c5a6de502847aece9e (patch)
tree3851341fafa09a8835f33301fc5a7b9763be359a /rpc/rpc-lib
parent2902b6f325d4bbb6cd947cee0301bf75d9634196 (diff)
rpc-clnt: perform XDR encoding in unlocked region
Change-Id: Ia11c3ced4bec5959a5f0d8fcd4c6070b2ead220a BUG: 3409 Reviewed-on: http://review.gluster.com/248 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'rpc/rpc-lib')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c77
1 files changed, 36 insertions, 41 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index a99894af591..c77882dd6de 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1371,53 +1371,49 @@ rpc_clnt_submit (struct rpc_clnt *rpc, rpc_clnt_prog_t *prog,
rpcreq->xid = callid;
rpcreq->cbkfn = cbkfn;
- pthread_mutex_lock (&conn->lock);
- {
- if (conn->connected == 0) {
- ret = rpc_transport_connect (conn->trans,
- conn->config.remote_port);
- /* Below code makes sure the (re-)configured port lasts
- for just one successful connect attempt */
- if (!ret)
- conn->config.remote_port = 0;
- }
+ ret = -1;
- ret = -1;
+ if (proghdr) {
+ proglen += iov_length (proghdr, proghdrcount);
+ }
- if (proghdr) {
- proglen += iov_length (proghdr, proghdrcount);
- }
+ if (progpayload) {
+ proglen += iov_length (progpayload,
+ progpayloadcount);
+ }
- if (progpayload) {
- proglen += iov_length (progpayload,
- progpayloadcount);
- }
+ request_iob = rpc_clnt_record (rpc, frame, prog,
+ procnum, proglen,
+ &rpchdr, callid);
+ if (!request_iob) {
+ gf_log (conn->trans->name, GF_LOG_WARNING,
+ "cannot build rpc-record");
+ goto out;
+ }
- request_iob = rpc_clnt_record (rpc, frame, prog,
- procnum, proglen,
- &rpchdr, callid);
- if (!request_iob) {
- gf_log (conn->trans->name, GF_LOG_WARNING,
- "cannot build rpc-record");
- goto unlock;
- }
+ iobref_add (iobref, request_iob);
- iobref_add (iobref, request_iob);
+ req.msg.rpchdr = &rpchdr;
+ req.msg.rpchdrcount = 1;
+ req.msg.proghdr = proghdr;
+ req.msg.proghdrcount = proghdrcount;
+ req.msg.progpayload = progpayload;
+ req.msg.progpayloadcount = progpayloadcount;
+ req.msg.iobref = iobref;
- req.msg.rpchdr = &rpchdr;
- req.msg.rpchdrcount = 1;
- req.msg.proghdr = proghdr;
- req.msg.proghdrcount = proghdrcount;
- req.msg.progpayload = progpayload;
- req.msg.progpayloadcount = progpayloadcount;
- req.msg.iobref = iobref;
+ req.rsp.rsphdr = rsphdr;
+ req.rsp.rsphdr_count = rsphdr_count;
+ req.rsp.rsp_payload = rsp_payload;
+ req.rsp.rsp_payload_count = rsp_payload_count;
+ req.rsp.rsp_iobref = rsp_iobref;
+ req.rpc_req = rpcreq;
- req.rsp.rsphdr = rsphdr;
- req.rsp.rsphdr_count = rsphdr_count;
- req.rsp.rsp_payload = rsp_payload;
- req.rsp.rsp_payload_count = rsp_payload_count;
- req.rsp.rsp_iobref = rsp_iobref;
- req.rpc_req = rpcreq;
+ pthread_mutex_lock (&conn->lock);
+ {
+ if (conn->connected == 0) {
+ rpc_transport_connect (conn->trans,
+ conn->config.remote_port);
+ }
ret = rpc_transport_submit_request (rpc->conn.trans,
&req);
@@ -1442,7 +1438,6 @@ rpc_clnt_submit (struct rpc_clnt *rpc, rpc_clnt_prog_t *prog,
rpcreq->procnum, rpc->conn.trans->name);
}
}
-unlock:
pthread_mutex_unlock (&conn->lock);
if (ret == -1) {