aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/vfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r--fs/nfsd/vfs.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 443ebc52e382..bfd36e587ec5 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -791,22 +791,26 @@ nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset
791{ 791{
792 unsigned long count = desc->count; 792 unsigned long count = desc->count;
793 struct svc_rqst *rqstp = desc->arg.data; 793 struct svc_rqst *rqstp = desc->arg.data;
794 struct page **pp = rqstp->rq_respages + rqstp->rq_resused;
794 795
795 if (size > count) 796 if (size > count)
796 size = count; 797 size = count;
797 798
798 if (rqstp->rq_res.page_len == 0) { 799 if (rqstp->rq_res.page_len == 0) {
799 get_page(page); 800 get_page(page);
800 rqstp->rq_respages[rqstp->rq_resused++] = page; 801 put_page(*pp);
802 *pp = page;
803 rqstp->rq_resused++;
801 rqstp->rq_res.page_base = offset; 804 rqstp->rq_res.page_base = offset;
802 rqstp->rq_res.page_len = size; 805 rqstp->rq_res.page_len = size;
803 } else if (page != rqstp->rq_respages[rqstp->rq_resused-1]) { 806 } else if (page != pp[-1]) {
804 get_page(page); 807 get_page(page);
805 rqstp->rq_respages[rqstp->rq_resused++] = page; 808 put_page(*pp);
809 *pp = page;
810 rqstp->rq_resused++;
806 rqstp->rq_res.page_len += size; 811 rqstp->rq_res.page_len += size;
807 } else { 812 } else
808 rqstp->rq_res.page_len += size; 813 rqstp->rq_res.page_len += size;
809 }
810 814
811 desc->count = count - size; 815 desc->count = count - size;
812 desc->written += size; 816 desc->written += size;
@@ -837,7 +841,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
837 file->f_ra = ra->p_ra; 841 file->f_ra = ra->p_ra;
838 842
839 if (file->f_op->sendfile && rqstp->rq_sendfile_ok) { 843 if (file->f_op->sendfile && rqstp->rq_sendfile_ok) {
840 svc_pushback_unused_pages(rqstp); 844 rqstp->rq_resused = 1;
841 err = file->f_op->sendfile(file, &offset, *count, 845 err = file->f_op->sendfile(file, &offset, *count,
842 nfsd_read_actor, rqstp); 846 nfsd_read_actor, rqstp);
843 } else { 847 } else {