Commit 4f819f27 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Fix byte counting for NFSv3 readdir replies

The amount of free space is calculated wrongly so
nfsv3 readdir replies are shorted than they could be.
parent 50030d57
......@@ -780,7 +780,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
{
struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres, common);
u32 *p = cd->buffer;
int buflen, slen, elen;
int slen, elen;
if (cd->offset)
xdr_encode_hyper(cd->offset, (u64) offset);
......@@ -797,7 +797,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
slen = XDR_QUADLEN(namlen);
elen = slen + NFS3_ENTRY_BAGGAGE
+ (plus? NFS3_ENTRYPLUS_BAGGAGE : 0);
if ((buflen = cd->buflen - elen) < 0) {
if (cd->buflen < elen) {
cd->common.err = nfserr_readdir_nospc;
return -EINVAL;
}
......@@ -836,7 +836,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
}
out:
cd->buflen = buflen;
cd->buflen -= p - cd->buffer;
cd->buffer = p;
cd->common.err = nfs_ok;
return 0;
......
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