Commit 97d312d0 authored by Manoj Naik's avatar Manoj Naik Committed by Trond Myklebust

[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: default avatarManoj Naik <manoj@almaden.ibm.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 8d0a8a9d
...@@ -1014,6 +1014,10 @@ static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) ...@@ -1014,6 +1014,10 @@ static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args)
static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req) static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req)
{ {
struct rpc_auth *auth = req->rq_task->tk_auth; struct rpc_auth *auth = req->rq_task->tk_auth;
uint32_t attrs[2] = {
FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID,
FATTR4_WORD1_MOUNTED_ON_FILEID,
};
int replen; int replen;
uint32_t *p; uint32_t *p;
...@@ -1024,13 +1028,13 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg ...@@ -1024,13 +1028,13 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
WRITE32(readdir->count >> 1); /* We're not doing readdirplus */ WRITE32(readdir->count >> 1); /* We're not doing readdirplus */
WRITE32(readdir->count); WRITE32(readdir->count);
WRITE32(2); WRITE32(2);
if (readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID) { /* Switch to mounted_on_fileid if the server supports it */
WRITE32(0); if (readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)
WRITE32(FATTR4_WORD1_MOUNTED_ON_FILEID); attrs[0] &= ~FATTR4_WORD0_FILEID;
} else { else
WRITE32(FATTR4_WORD0_FILEID); attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
WRITE32(0); WRITE32(attrs[0] & readdir->bitmask[0]);
} WRITE32(attrs[1] & readdir->bitmask[1]);
/* set up reply kvec /* set up reply kvec
* toplevel_status + taglen + rescount + OP_PUTFH + status * 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,6 +4064,12 @@ uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus)
} }
len = XDR_QUADLEN(ntohl(*p++)); /* attribute buffer length */ len = XDR_QUADLEN(ntohl(*p++)); /* attribute buffer length */
if (len > 0) { if (len > 0) {
if (bitmap[0] & FATTR4_WORD0_RDATTR_ERROR) {
bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR;
/* Ignore the return value of rdattr_error for now */
p++;
len--;
}
if (bitmap[0] == 0 && bitmap[1] == FATTR4_WORD1_MOUNTED_ON_FILEID) if (bitmap[0] == 0 && bitmap[1] == FATTR4_WORD1_MOUNTED_ON_FILEID)
xdr_decode_hyper(p, &entry->ino); xdr_decode_hyper(p, &entry->ino);
else if (bitmap[0] == FATTR4_WORD0_FILEID) else if (bitmap[0] == FATTR4_WORD0_FILEID)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment