aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorManoj Naik <manoj@almaden.ibm.com>2005-06-22 13:16:39 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-06-22 16:07:43 -0400
commit97d312d037e63e7c8ac004ffe3072f82a6d45495 (patch)
treec5fb167f0a523763113b778c45f3e56367456dbd /fs
parent8d0a8a9d0ec790086c64d210af413ac351d89e35 (diff)
[PATCH] NFSv4: add support for rdattr_error in NFSv4 readdir requests.
Request RDATTR_ERROR as an attribute in readdir to distinguish between a directory being within an absent filesystem or one (or more) of its entries. Signed-off-by: Manoj Naik <manoj@almaden.ibm.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4xdr.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 325cd6d4f23a..4d655d252c6d 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1014,6 +1014,10 @@ static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args)
1014static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req) 1014static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req)
1015{ 1015{
1016 struct rpc_auth *auth = req->rq_task->tk_auth; 1016 struct rpc_auth *auth = req->rq_task->tk_auth;
1017 uint32_t attrs[2] = {
1018 FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID,
1019 FATTR4_WORD1_MOUNTED_ON_FILEID,
1020 };
1017 int replen; 1021 int replen;
1018 uint32_t *p; 1022 uint32_t *p;
1019 1023
@@ -1024,13 +1028,13 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1024 WRITE32(readdir->count >> 1); /* We're not doing readdirplus */ 1028 WRITE32(readdir->count >> 1); /* We're not doing readdirplus */
1025 WRITE32(readdir->count); 1029 WRITE32(readdir->count);
1026 WRITE32(2); 1030 WRITE32(2);
1027 if (readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID) { 1031 /* Switch to mounted_on_fileid if the server supports it */
1028 WRITE32(0); 1032 if (readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)
1029 WRITE32(FATTR4_WORD1_MOUNTED_ON_FILEID); 1033 attrs[0] &= ~FATTR4_WORD0_FILEID;
1030 } else { 1034 else
1031 WRITE32(FATTR4_WORD0_FILEID); 1035 attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
1032 WRITE32(0); 1036 WRITE32(attrs[0] & readdir->bitmask[0]);
1033 } 1037 WRITE32(attrs[1] & readdir->bitmask[1]);
1034 1038
1035 /* set up reply kvec 1039 /* set up reply kvec
1036 * toplevel_status + taglen + rescount + OP_PUTFH + status 1040 * toplevel_status + taglen + rescount + OP_PUTFH + status
@@ -4060,6 +4064,12 @@ uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus)
4060 } 4064 }
4061 len = XDR_QUADLEN(ntohl(*p++)); /* attribute buffer length */ 4065 len = XDR_QUADLEN(ntohl(*p++)); /* attribute buffer length */
4062 if (len > 0) { 4066 if (len > 0) {
4067 if (bitmap[0] & FATTR4_WORD0_RDATTR_ERROR) {
4068 bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR;
4069 /* Ignore the return value of rdattr_error for now */
4070 p++;
4071 len--;
4072 }
4063 if (bitmap[0] == 0 && bitmap[1] == FATTR4_WORD1_MOUNTED_ON_FILEID) 4073 if (bitmap[0] == 0 && bitmap[1] == FATTR4_WORD1_MOUNTED_ON_FILEID)
4064 xdr_decode_hyper(p, &entry->ino); 4074 xdr_decode_hyper(p, &entry->ino);
4065 else if (bitmap[0] == FATTR4_WORD0_FILEID) 4075 else if (bitmap[0] == FATTR4_WORD0_FILEID)