aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs3xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs3xdr.c')
-rw-r--r--fs/nfsd/nfs3xdr.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 243d94b9653a..20ba728a4642 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -343,8 +343,7 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
343 /* set up the kvec */ 343 /* set up the kvec */
344 v=0; 344 v=0;
345 while (len > 0) { 345 while (len > 0) {
346 pn = rqstp->rq_resused; 346 pn = rqstp->rq_resused++;
347 svc_take_page(rqstp);
348 args->vec[v].iov_base = page_address(rqstp->rq_respages[pn]); 347 args->vec[v].iov_base = page_address(rqstp->rq_respages[pn]);
349 args->vec[v].iov_len = len < PAGE_SIZE? len : PAGE_SIZE; 348 args->vec[v].iov_len = len < PAGE_SIZE? len : PAGE_SIZE;
350 len -= args->vec[v].iov_len; 349 len -= args->vec[v].iov_len;
@@ -382,7 +381,7 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
382 while (len > args->vec[v].iov_len) { 381 while (len > args->vec[v].iov_len) {
383 len -= args->vec[v].iov_len; 382 len -= args->vec[v].iov_len;
384 v++; 383 v++;
385 args->vec[v].iov_base = page_address(rqstp->rq_argpages[v]); 384 args->vec[v].iov_base = page_address(rqstp->rq_pages[v]);
386 args->vec[v].iov_len = PAGE_SIZE; 385 args->vec[v].iov_len = PAGE_SIZE;
387 } 386 }
388 args->vec[v].iov_len = len; 387 args->vec[v].iov_len = len;
@@ -446,11 +445,11 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p,
446 * This page appears in the rq_res.pages list, but as pages_len is always 445 * This page appears in the rq_res.pages list, but as pages_len is always
447 * 0, it won't get in the way 446 * 0, it won't get in the way
448 */ 447 */
449 svc_take_page(rqstp);
450 len = ntohl(*p++); 448 len = ntohl(*p++);
451 if (len == 0 || len > NFS3_MAXPATHLEN || len >= PAGE_SIZE) 449 if (len == 0 || len > NFS3_MAXPATHLEN || len >= PAGE_SIZE)
452 return 0; 450 return 0;
453 args->tname = new = page_address(rqstp->rq_respages[rqstp->rq_resused-1]); 451 args->tname = new =
452 page_address(rqstp->rq_respages[rqstp->rq_resused++]);
454 args->tlen = len; 453 args->tlen = len;
455 /* first copy and check from the first page */ 454 /* first copy and check from the first page */
456 old = (char*)p; 455 old = (char*)p;
@@ -522,8 +521,8 @@ nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p,
522{ 521{
523 if (!(p = decode_fh(p, &args->fh))) 522 if (!(p = decode_fh(p, &args->fh)))
524 return 0; 523 return 0;
525 svc_take_page(rqstp); 524 args->buffer =
526 args->buffer = page_address(rqstp->rq_respages[rqstp->rq_resused-1]); 525 page_address(rqstp->rq_respages[rqstp->rq_resused++]);
527 526
528 return xdr_argsize_check(rqstp, p); 527 return xdr_argsize_check(rqstp, p);
529} 528}
@@ -554,8 +553,8 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p,
554 if (args->count > PAGE_SIZE) 553 if (args->count > PAGE_SIZE)
555 args->count = PAGE_SIZE; 554 args->count = PAGE_SIZE;
556 555
557 svc_take_page(rqstp); 556 args->buffer =
558 args->buffer = page_address(rqstp->rq_respages[rqstp->rq_resused-1]); 557 page_address(rqstp->rq_respages[rqstp->rq_resused++]);
559 558
560 return xdr_argsize_check(rqstp, p); 559 return xdr_argsize_check(rqstp, p);
561} 560}
@@ -578,8 +577,7 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p,
578 args->count = len; 577 args->count = len;
579 578
580 while (len > 0) { 579 while (len > 0) {
581 pn = rqstp->rq_resused; 580 pn = rqstp->rq_resused++;
582 svc_take_page(rqstp);
583 if (!args->buffer) 581 if (!args->buffer)
584 args->buffer = page_address(rqstp->rq_respages[pn]); 582 args->buffer = page_address(rqstp->rq_respages[pn]);
585 len -= PAGE_SIZE; 583 len -= PAGE_SIZE;
@@ -668,7 +666,6 @@ nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p,
668 rqstp->rq_res.page_len = resp->len; 666 rqstp->rq_res.page_len = resp->len;
669 if (resp->len & 3) { 667 if (resp->len & 3) {
670 /* need to pad the tail */ 668 /* need to pad the tail */
671 rqstp->rq_restailpage = 0;
672 rqstp->rq_res.tail[0].iov_base = p; 669 rqstp->rq_res.tail[0].iov_base = p;
673 *p = 0; 670 *p = 0;
674 rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3); 671 rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3);
@@ -693,7 +690,6 @@ nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p,
693 rqstp->rq_res.page_len = resp->count; 690 rqstp->rq_res.page_len = resp->count;
694 if (resp->count & 3) { 691 if (resp->count & 3) {
695 /* need to pad the tail */ 692 /* need to pad the tail */
696 rqstp->rq_restailpage = 0;
697 rqstp->rq_res.tail[0].iov_base = p; 693 rqstp->rq_res.tail[0].iov_base = p;
698 *p = 0; 694 *p = 0;
699 rqstp->rq_res.tail[0].iov_len = 4 - (resp->count & 3); 695 rqstp->rq_res.tail[0].iov_len = 4 - (resp->count & 3);
@@ -768,7 +764,6 @@ nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p,
768 rqstp->rq_res.page_len = (resp->count) << 2; 764 rqstp->rq_res.page_len = (resp->count) << 2;
769 765
770 /* add the 'tail' to the end of the 'head' page - page 0. */ 766 /* add the 'tail' to the end of the 'head' page - page 0. */
771 rqstp->rq_restailpage = 0;
772 rqstp->rq_res.tail[0].iov_base = p; 767 rqstp->rq_res.tail[0].iov_base = p;
773 *p++ = 0; /* no more entries */ 768 *p++ = 0; /* no more entries */
774 *p++ = htonl(resp->common.err == nfserr_eof); 769 *p++ = htonl(resp->common.err == nfserr_eof);