summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-04-19 12:18:53 +0530
committerAnand Avati <avati@redhat.com>2012-04-19 00:28:39 -0700
commit1a46dcecd0cfba549ae54bf61eaea2223b39c10f (patch)
treeaa3898d7a735140e20918793e09ebebfe55e51f5 /rpc/rpc-lib
parent3ad81d490f9e822efa34b3ffaf3c527e99af5d40 (diff)
rpc-clnt: use the correct xdr_size for getting the iobuf
earlier we used to get the size of rpc_msg from an empty msg, which was resulting in minimum size allocated for rpc-msg. the correct way is to fill the required fields in rpc_msg structure and then calculate the size, and allocate the iobuf. Change-Id: I3692831b53b8820a36e4562a1fa3d4c3dbdf4f9d BUG: 813787 Signed-off-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: http://review.gluster.com/3191 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'rpc/rpc-lib')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index 428a82b76aa..950c4ecc5ff 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1232,20 +1232,6 @@ rpc_clnt_record_build_record (struct rpc_clnt *clnt, int prognum, int progver,
goto out;
}
- xdr_size = xdr_sizeof ((xdrproc_t)xdr_callmsg, &request);
-
- /* First, try to get a pointer into the buffer which the RPC
- * layer can use.
- */
- request_iob = iobuf_get2 (clnt->ctx->iobuf_pool, (xdr_size + hdrsize));
- if (!request_iob) {
- goto out;
- }
-
- pagesize = iobuf_pagesize (request_iob);
-
- record = iobuf_ptr (request_iob); /* Now we have it. */
-
/* Fill the rpc structure and XDR it into the buffer got above. */
if (clnt->auth_null)
ret = rpc_clnt_fill_request (prognum, progver, procnum,
@@ -1260,6 +1246,20 @@ rpc_clnt_record_build_record (struct rpc_clnt *clnt, int prognum, int progver,
goto out;
}
+ xdr_size = xdr_sizeof ((xdrproc_t)xdr_callmsg, &request);
+
+ /* First, try to get a pointer into the buffer which the RPC
+ * layer can use.
+ */
+ request_iob = iobuf_get2 (clnt->ctx->iobuf_pool, (xdr_size + hdrsize));
+ if (!request_iob) {
+ goto out;
+ }
+
+ pagesize = iobuf_pagesize (request_iob);
+
+ record = iobuf_ptr (request_iob); /* Now we have it. */
+
recordhdr = rpc_clnt_record_build_header (record, pagesize, &request,
hdrsize);