From 1a46dcecd0cfba549ae54bf61eaea2223b39c10f Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 19 Apr 2012 12:18:53 +0530 Subject: 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 Reviewed-on: http://review.gluster.com/3191 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- rpc/rpc-lib/src/rpc-clnt.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'rpc/rpc-lib') diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index 428a82b76..950c4ecc5 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); -- cgit