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