aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-19 10:03:38 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-19 15:09:04 -0400
commite3a535e1739a9da3cc316ccdfe5cd4bf84d745ac (patch)
tree9730d4689879bfaf4d9de87df513b9510edf7432
parentd6ac02dfaa6c423874839fe289c7320624aa9288 (diff)
NFSv4: Fix the nfsv4 readlink reply buffer alignment
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/nfs4xdr.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index bec171a493a4..7b73ca8be909 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1201,21 +1201,11 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1201 1201
1202static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req) 1202static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req)
1203{ 1203{
1204 struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
1205 unsigned int replen;
1206 __be32 *p; 1204 __be32 *p;
1207 1205
1208 RESERVE_SPACE(4); 1206 RESERVE_SPACE(4);
1209 WRITE32(OP_READLINK); 1207 WRITE32(OP_READLINK);
1210 1208
1211 /* set up reply kvec
1212 * toplevel_status + taglen + rescount + OP_PUTFH + status
1213 * + OP_READLINK + status + string length = 8
1214 */
1215 replen = (RPC_REPHDRSIZE + auth->au_rslack + 8) << 2;
1216 xdr_inline_pages(&req->rq_rcv_buf, replen, readlink->pages,
1217 readlink->pgbase, readlink->pglen);
1218
1219 return 0; 1209 return 0;
1220} 1210}
1221 1211
@@ -1781,6 +1771,8 @@ static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct n
1781 struct compound_hdr hdr = { 1771 struct compound_hdr hdr = {
1782 .nops = 2, 1772 .nops = 2,
1783 }; 1773 };
1774 struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
1775 unsigned int replen;
1784 int status; 1776 int status;
1785 1777
1786 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1778 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1789,6 +1781,15 @@ static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct n
1789 if(status) 1781 if(status)
1790 goto out; 1782 goto out;
1791 status = encode_readlink(&xdr, args, req); 1783 status = encode_readlink(&xdr, args, req);
1784
1785 /* set up reply kvec
1786 * toplevel_status + taglen + rescount + OP_PUTFH + status
1787 * + OP_READLINK + status + string length = 8
1788 */
1789 replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readlink_sz) << 2;
1790 xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages,
1791 args->pgbase, args->pglen);
1792
1792out: 1793out:
1793 return status; 1794 return status;
1794} 1795}