Commit 3172a066 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd:fix read encoding

encode_read: change 'len' variable from unsigned long to a long for
'(len > 0)' comparison.  don't set up a tail iovec for zero length
reads.
parent 7ca47b80
...@@ -1691,7 +1691,8 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_read ...@@ -1691,7 +1691,8 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_read
{ {
u32 eof; u32 eof;
int v, pn; int v, pn;
unsigned long maxcount, len; unsigned long maxcount;
long len;
ENCODE_HEAD; ENCODE_HEAD;
if (nfserr) if (nfserr)
...@@ -1732,6 +1733,10 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_read ...@@ -1732,6 +1733,10 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_read
resp->xbuf->page_len = maxcount; resp->xbuf->page_len = maxcount;
/* read zero bytes -> don't set up tail */
if(!maxcount)
return 0;
/* set up page for remaining responses */ /* set up page for remaining responses */
svc_take_page(resp->rqstp); svc_take_page(resp->rqstp);
resp->xbuf->tail[0].iov_base = resp->xbuf->tail[0].iov_base =
......
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