Commit e3a535e1739a9da3cc316ccdfe5cd4bf84d745ac

Authored by Trond Myklebust
1 parent d6ac02dfaa

NFSv4: Fix the nfsv4 readlink reply buffer alignment

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 1 changed file with 11 additions and 10 deletions Side-by-side Diff

... ... @@ -1201,21 +1201,11 @@
1201 1201  
1202 1202 static 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 1204 __be32 *p;
1207 1205  
1208 1206 RESERVE_SPACE(4);
1209 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 1209 return 0;
1220 1210 }
1221 1211  
... ... @@ -1781,6 +1771,8 @@
1781 1771 struct compound_hdr hdr = {
1782 1772 .nops = 2,
1783 1773 };
  1774 + struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
  1775 + unsigned int replen;
1784 1776 int status;
1785 1777  
1786 1778 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
... ... @@ -1789,6 +1781,15 @@
1789 1781 if(status)
1790 1782 goto out;
1791 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 +
1792 1793 out:
1793 1794 return status;
1794 1795 }