aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 5be00436b5b8..9f30c53ac0ed 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2039,7 +2039,8 @@ nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, int nfserr, struct n
2039} 2039}
2040 2040
2041static int 2041static int
2042nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_read *read) 2042nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr,
2043 struct nfsd4_read *read)
2043{ 2044{
2044 u32 eof; 2045 u32 eof;
2045 int v, pn; 2046 int v, pn;
@@ -2061,10 +2062,11 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_read
2061 len = maxcount; 2062 len = maxcount;
2062 v = 0; 2063 v = 0;
2063 while (len > 0) { 2064 while (len > 0) {
2064 pn = resp->rqstp->rq_resused; 2065 pn = resp->rqstp->rq_resused++;
2065 svc_take_page(resp->rqstp); 2066 read->rd_iov[v].iov_base =
2066 read->rd_iov[v].iov_base = page_address(resp->rqstp->rq_respages[pn]); 2067 page_address(resp->rqstp->rq_respages[pn]);
2067 read->rd_iov[v].iov_len = len < PAGE_SIZE ? len : PAGE_SIZE; 2068 read->rd_iov[v].iov_len =
2069 len < PAGE_SIZE ? len : PAGE_SIZE;
2068 v++; 2070 v++;
2069 len -= PAGE_SIZE; 2071 len -= PAGE_SIZE;
2070 } 2072 }
@@ -2078,7 +2080,8 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_read
2078 nfserr = nfserr_inval; 2080 nfserr = nfserr_inval;
2079 if (nfserr) 2081 if (nfserr)
2080 return nfserr; 2082 return nfserr;
2081 eof = (read->rd_offset + maxcount >= read->rd_fhp->fh_dentry->d_inode->i_size); 2083 eof = (read->rd_offset + maxcount >=
2084 read->rd_fhp->fh_dentry->d_inode->i_size);
2082 2085
2083 WRITE32(eof); 2086 WRITE32(eof);
2084 WRITE32(maxcount); 2087 WRITE32(maxcount);
@@ -2088,7 +2091,6 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_read
2088 resp->xbuf->page_len = maxcount; 2091 resp->xbuf->page_len = maxcount;
2089 2092
2090 /* Use rest of head for padding and remaining ops: */ 2093 /* Use rest of head for padding and remaining ops: */
2091 resp->rqstp->rq_restailpage = 0;
2092 resp->xbuf->tail[0].iov_base = p; 2094 resp->xbuf->tail[0].iov_base = p;
2093 resp->xbuf->tail[0].iov_len = 0; 2095 resp->xbuf->tail[0].iov_len = 0;
2094 if (maxcount&3) { 2096 if (maxcount&3) {
@@ -2113,8 +2115,7 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_r
2113 if (resp->xbuf->page_len) 2115 if (resp->xbuf->page_len)
2114 return nfserr_resource; 2116 return nfserr_resource;
2115 2117
2116 svc_take_page(resp->rqstp); 2118 page = page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused++]);
2117 page = page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]);
2118 2119
2119 maxcount = PAGE_SIZE; 2120 maxcount = PAGE_SIZE;
2120 RESERVE_SPACE(4); 2121 RESERVE_SPACE(4);
@@ -2138,7 +2139,6 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_r
2138 resp->xbuf->page_len = maxcount; 2139 resp->xbuf->page_len = maxcount;
2139 2140
2140 /* Use rest of head for padding and remaining ops: */ 2141 /* Use rest of head for padding and remaining ops: */
2141 resp->rqstp->rq_restailpage = 0;
2142 resp->xbuf->tail[0].iov_base = p; 2142 resp->xbuf->tail[0].iov_base = p;
2143 resp->xbuf->tail[0].iov_len = 0; 2143 resp->xbuf->tail[0].iov_len = 0;
2144 if (maxcount&3) { 2144 if (maxcount&3) {
@@ -2189,8 +2189,7 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_re
2189 goto err_no_verf; 2189 goto err_no_verf;
2190 } 2190 }
2191 2191
2192 svc_take_page(resp->rqstp); 2192 page = page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused++]);
2193 page = page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]);
2194 readdir->common.err = 0; 2193 readdir->common.err = 0;
2195 readdir->buflen = maxcount; 2194 readdir->buflen = maxcount;
2196 readdir->buffer = page; 2195 readdir->buffer = page;
@@ -2215,10 +2214,10 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_re
2215 p = readdir->buffer; 2214 p = readdir->buffer;
2216 *p++ = 0; /* no more entries */ 2215 *p++ = 0; /* no more entries */
2217 *p++ = htonl(readdir->common.err == nfserr_eof); 2216 *p++ = htonl(readdir->common.err == nfserr_eof);
2218 resp->xbuf->page_len = ((char*)p) - (char*)page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]); 2217 resp->xbuf->page_len = ((char*)p) - (char*)page_address(
2218 resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]);
2219 2219
2220 /* Use rest of head for padding and remaining ops: */ 2220 /* Use rest of head for padding and remaining ops: */
2221 resp->rqstp->rq_restailpage = 0;
2222 resp->xbuf->tail[0].iov_base = tailbase; 2221 resp->xbuf->tail[0].iov_base = tailbase;
2223 resp->xbuf->tail[0].iov_len = 0; 2222 resp->xbuf->tail[0].iov_len = 0;
2224 resp->p = resp->xbuf->tail[0].iov_base; 2223 resp->p = resp->xbuf->tail[0].iov_base;