Commit f08e21d0 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kNFSd: readdir error code fix

From: NeilBrown <neilb@cse.unsw.edu.au>

changes nfserr_readdir_nospc to nfserr_toosmall, following rfc3530 which has
no nfserr_readdir_nospc.

error 10030 which was nfserr_readdir_nospc is actually nfserr_restorefh.
parent bd290dbf
......@@ -796,7 +796,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
elen = slen + NFS3_ENTRY_BAGGAGE
+ (plus? NFS3_ENTRYPLUS_BAGGAGE : 0);
if (cd->buflen < elen) {
cd->common.err = nfserr_readdir_nospc;
cd->common.err = nfserr_toosmall;
return -EINVAL;
}
*p++ = xdr_one; /* mark entry present */
......
......@@ -1688,7 +1688,7 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
return 0;
nospc:
cd->common.err = nfserr_readdir_nospc;
cd->common.err = nfserr_toosmall;
return -EINVAL;
}
......@@ -2097,7 +2097,7 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_re
*/
maxcount = (maxcount >> 2) - 4;
if (maxcount < 0)
return nfserr_readdir_nospc;
return nfserr_toosmall;
svc_take_page(resp->rqstp);
page = page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]);
......@@ -2111,9 +2111,9 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_re
&offset,
&readdir->common, nfsd4_encode_dirent);
if (nfserr == nfs_ok &&
readdir->common.err == nfserr_readdir_nospc &&
readdir->common.err == nfserr_toosmall &&
readdir->buffer == page)
nfserr = nfserr_readdir_nospc;
nfserr = nfserr_toosmall;
if (nfserr)
return nfserr;
......
......@@ -484,7 +484,7 @@ nfssvc_encode_entry(struct readdir_cd *ccd, const char *name,
slen = XDR_QUADLEN(namlen);
if ((buflen = cd->buflen - slen - 4) < 0) {
cd->common.err = nfserr_readdir_nospc;
cd->common.err = nfserr_toosmall;
return -EINVAL;
}
*p++ = xdr_one; /* mark entry present */
......
......@@ -1494,7 +1494,7 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
err = cdp->err;
*offsetp = file.f_pos;
if (err == nfserr_eof || err == nfserr_readdir_nospc)
if (err == nfserr_eof || err == nfserr_toosmall)
err = nfs_ok; /* can still be found in ->err */
out_close:
nfsd_close(&file);
......
......@@ -92,7 +92,7 @@
NFSERR_NOT_SAME = 10027, /* v4 */
NFSERR_LOCK_RANGE = 10028, /* v4 */
NFSERR_SYMLINK = 10029, /* v4 */
NFSERR_READDIR_NOSPC = 10030, /* v4 */
NFSERR_RESTOREFH = 10030, /* v4 */
NFSERR_LEASE_MOVED = 10031, /* v4 */
NFSERR_ATTRNOTSUPP = 10032, /* v4 */
NFSERR_NO_GRACE = 10033, /* v4 */
......
......@@ -190,7 +190,7 @@ void nfsd_lockd_shutdown(void);
#define nfserr_bad_seqid __constant_htonl(NFSERR_BAD_SEQID)
#define nfserr_symlink __constant_htonl(NFSERR_SYMLINK)
#define nfserr_not_same __constant_htonl(NFSERR_NOT_SAME)
#define nfserr_readdir_nospc __constant_htonl(NFSERR_READDIR_NOSPC)
#define nfserr_restorefh __constant_htonl(NFSERR_RESTOREFH)
#define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR)
#define nfserr_openmode __constant_htonl(NFSERR_OPENMODE)
......
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