aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-10-24 12:11:42 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-10-24 13:20:25 -0400
commit6f7a35bd23bdbbb40c07ee1120ef047190e77d9b (patch)
tree27b8aea3b8bf8bf813eedd59808f18da8b3e0a24 /fs/nfs/nfs4xdr.c
parent9af8c222ca5eae88f000664f693316480bf58fbc (diff)
NFSv4: Fix up the 'dircount' hint in encode_readdir
Also ensure we only ask for either fileid or mounted_on_fileid in the readdirplus case too... Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 4c43e4874c52..1e5d68e36e07 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1386,6 +1386,7 @@ static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args,
1386static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req, struct compound_hdr *hdr) 1386static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req, struct compound_hdr *hdr)
1387{ 1387{
1388 uint32_t attrs[2] = {0, 0}; 1388 uint32_t attrs[2] = {0, 0};
1389 uint32_t dircount = readdir->count >> 1;
1389 __be32 *p; 1390 __be32 *p;
1390 1391
1391 if (readdir->plus) { 1392 if (readdir->plus) {
@@ -1395,26 +1396,24 @@ static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1395 FATTR4_WORD1_OWNER_GROUP|FATTR4_WORD1_RAWDEV| 1396 FATTR4_WORD1_OWNER_GROUP|FATTR4_WORD1_RAWDEV|
1396 FATTR4_WORD1_SPACE_USED|FATTR4_WORD1_TIME_ACCESS| 1397 FATTR4_WORD1_SPACE_USED|FATTR4_WORD1_TIME_ACCESS|
1397 FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; 1398 FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY;
1399 dircount >>= 1;
1398 } 1400 }
1399 attrs[0] |= FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID; 1401 attrs[0] |= FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID;
1400 attrs[1] |= FATTR4_WORD1_MOUNTED_ON_FILEID; 1402 attrs[1] |= FATTR4_WORD1_MOUNTED_ON_FILEID;
1403 /* Switch to mounted_on_fileid if the server supports it */
1404 if (readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)
1405 attrs[0] &= ~FATTR4_WORD0_FILEID;
1406 else
1407 attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
1401 1408
1402 p = reserve_space(xdr, 12+NFS4_VERIFIER_SIZE+20); 1409 p = reserve_space(xdr, 12+NFS4_VERIFIER_SIZE+20);
1403 *p++ = cpu_to_be32(OP_READDIR); 1410 *p++ = cpu_to_be32(OP_READDIR);
1404 p = xdr_encode_hyper(p, readdir->cookie); 1411 p = xdr_encode_hyper(p, readdir->cookie);
1405 p = xdr_encode_opaque_fixed(p, readdir->verifier.data, NFS4_VERIFIER_SIZE); 1412 p = xdr_encode_opaque_fixed(p, readdir->verifier.data, NFS4_VERIFIER_SIZE);
1406 *p++ = cpu_to_be32(readdir->count >> 1); /* We're not doing readdirplus */ 1413 *p++ = cpu_to_be32(dircount);
1407 *p++ = cpu_to_be32(readdir->count); 1414 *p++ = cpu_to_be32(readdir->count);
1408 *p++ = cpu_to_be32(2); 1415 *p++ = cpu_to_be32(2);
1409 1416
1410 if (!readdir->plus) {
1411 /* Switch to mounted_on_fileid if the server supports it */
1412 if (readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)
1413 attrs[0] &= ~FATTR4_WORD0_FILEID;
1414 else
1415 attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
1416 }
1417
1418 *p++ = cpu_to_be32(attrs[0] & readdir->bitmask[0]); 1417 *p++ = cpu_to_be32(attrs[0] & readdir->bitmask[0]);
1419 *p = cpu_to_be32(attrs[1] & readdir->bitmask[1]); 1418 *p = cpu_to_be32(attrs[1] & readdir->bitmask[1]);
1420 hdr->nops++; 1419 hdr->nops++;