aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2005-01-04 05:47:03 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-04 05:47:03 -0800
commitbdc337cc408a196f2ef092472ef3a056ca859f25 (patch)
tree8479e6e7807bac7c7910d1685c57949c4b35cc0e /fs
parent48a8a48e4517452ef105b22c123dce5d3f7b7e4e (diff)
downloadhistory-bdc337cc408a196f2ef092472ef3a056ca859f25.tar.gz
[PATCH] knfsd: nfsd4: encode_dirent: simplify error handling
Minor simplification of error handling in encode_dirent. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4xdr.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 99bb94751faa70..ce392ee2c6bb9c 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1830,7 +1830,7 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common);
int buflen;
u32 *p = cd->buffer;
- int nfserr = 0;
+ int nfserr = nfserr_toosmall;
/* In nfsv4, "." and ".." never make it onto the wire.. */
if (name && isdotent(name, namlen)) {
@@ -1843,7 +1843,7 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
buflen = cd->buflen - 4 - XDR_QUADLEN(namlen);
if (buflen < 0)
- goto nospc;
+ goto fail;
*p++ = xdr_one; /* mark entry present */
cd->offset = p; /* remember pointer */
@@ -1858,8 +1858,10 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
p += buflen;
goto out;
}
- if (nfserr == nfserr_resource)
- goto nospc;
+ if (nfserr == nfserr_resource) {
+ nfserr = nfserr_toosmall;
+ goto fail;
+ }
/*
* If we get here, we experienced a miscellaneous
@@ -1870,13 +1872,12 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
* then in accordance with the spec, we fail the
* entire READDIR operation(!)
*/
- if (!(cd->rd_bmval[0] & FATTR4_WORD0_RDATTR_ERROR)) {
- cd->common.err = nfserr;
- return -EINVAL;
- }
+ if (!(cd->rd_bmval[0] & FATTR4_WORD0_RDATTR_ERROR))
+ goto fail;
+ nfserr = nfserr_toosmall;
p = nfsd4_encode_rdattr_error(p, buflen, nfserr);
if (p == NULL)
- goto out_nospc;
+ goto fail;
out:
cd->buflen -= (p - cd->buffer);
@@ -1884,8 +1885,8 @@ out:
cd->common.err = nfs_ok;
return 0;
-nospc:
- cd->common.err = nfserr_toosmall;
+fail:
+ cd->common.err = nfserr;
return -EINVAL;
}