diff options
author | Anand Avati <avati@gluster.com> | 2011-08-12 00:46:50 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-08-17 21:01:05 -0700 |
commit | 53b8c4388dd885c17ab7700a020fcc4f2309d9e1 (patch) | |
tree | 6a1923872805e28f299fe662853daaf121bcc5d0 /rpc | |
parent | adc1ccf1f7ff7b8c25849bfc4a36f3708829a4db (diff) |
rpc-clnt: perform XDR encoding in unlocked region
Change-Id: Ia11c3ced4bec5959a5f0d8fcd4c6070b2ead220a
BUG: 3409
Reviewed-on: http://review.gluster.com/242
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 73 |
1 files changed, 36 insertions, 37 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index b6bac40b4..396c84cdb 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -1357,49 +1357,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) { - rpc_transport_connect (conn->trans, - conn->config.remote_port); - } + 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); @@ -1424,7 +1424,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) { |