aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-19 10:03:37 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-19 15:09:04 -0400
commitd6ac02dfaa6c423874839fe289c7320624aa9288 (patch)
treecaa14224aa031779251b1ffc340e2fbbf00a9b63 /fs/nfs
parent9104a55dc382c4aae42dff3f54351085cbcb7317 (diff)
NFSv4: Fix the readdir reply buffer alignment
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4xdr.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 5eb92f1e2e10..bec171a493a4 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1168,12 +1168,10 @@ static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args)
1168 1168
1169static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req) 1169static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req)
1170{ 1170{
1171 struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
1172 uint32_t attrs[2] = { 1171 uint32_t attrs[2] = {
1173 FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID, 1172 FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID,
1174 FATTR4_WORD1_MOUNTED_ON_FILEID, 1173 FATTR4_WORD1_MOUNTED_ON_FILEID,
1175 }; 1174 };
1176 int replen;
1177 __be32 *p; 1175 __be32 *p;
1178 1176
1179 RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20); 1177 RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20);
@@ -1198,17 +1196,6 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1198 attrs[0] & readdir->bitmask[0], 1196 attrs[0] & readdir->bitmask[0],
1199 attrs[1] & readdir->bitmask[1]); 1197 attrs[1] & readdir->bitmask[1]);
1200 1198
1201 /* set up reply kvec
1202 * toplevel_status + taglen + rescount + OP_PUTFH + status
1203 * + OP_READDIR + status + verifer(2) = 9
1204 */
1205 replen = (RPC_REPHDRSIZE + auth->au_rslack + 9) << 2;
1206 xdr_inline_pages(&req->rq_rcv_buf, replen, readdir->pages,
1207 readdir->pgbase, readdir->count);
1208 dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",
1209 __FUNCTION__, replen, readdir->pages,
1210 readdir->pgbase, readdir->count);
1211
1212 return 0; 1199 return 0;
1213} 1200}
1214 1201
@@ -1815,6 +1802,8 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf
1815 struct compound_hdr hdr = { 1802 struct compound_hdr hdr = {
1816 .nops = 2, 1803 .nops = 2,
1817 }; 1804 };
1805 struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
1806 int replen;
1818 int status; 1807 int status;
1819 1808
1820 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1809 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1823,6 +1812,18 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf
1823 if(status) 1812 if(status)
1824 goto out; 1813 goto out;
1825 status = encode_readdir(&xdr, args, req); 1814 status = encode_readdir(&xdr, args, req);
1815
1816 /* set up reply kvec
1817 * toplevel_status + taglen + rescount + OP_PUTFH + status
1818 * + OP_READDIR + status + verifer(2) = 9
1819 */
1820 replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readdir_sz) << 2;
1821 xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages,
1822 args->pgbase, args->count);
1823 dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",
1824 __FUNCTION__, replen, args->pages,
1825 args->pgbase, args->count);
1826
1826out: 1827out:
1827 return status; 1828 return status;
1828} 1829}