Commit e5f3ec38 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'nfsd-6.1-6' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux

Pull nfsd fix from Chuck Lever:

 - Fix rare data corruption on READ operations

* tag 'nfsd-6.1-6' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
  NFSD: Fix reads with a non-zero offset that don't end on a page boundary
parents 644e9524 ac8db824
...@@ -871,10 +871,11 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf, ...@@ -871,10 +871,11 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
struct svc_rqst *rqstp = sd->u.data; struct svc_rqst *rqstp = sd->u.data;
struct page *page = buf->page; // may be a compound one struct page *page = buf->page; // may be a compound one
unsigned offset = buf->offset; unsigned offset = buf->offset;
struct page *last_page;
page += offset / PAGE_SIZE; last_page = page + (offset + sd->len - 1) / PAGE_SIZE;
for (int i = sd->len; i > 0; i -= PAGE_SIZE) for (page += offset / PAGE_SIZE; page <= last_page; page++)
svc_rqst_replace_page(rqstp, page++); svc_rqst_replace_page(rqstp, page);
if (rqstp->rq_res.page_len == 0) // first call if (rqstp->rq_res.page_len == 0) // first call
rqstp->rq_res.page_base = offset % PAGE_SIZE; rqstp->rq_res.page_base = offset % PAGE_SIZE;
rqstp->rq_res.page_len += sd->len; rqstp->rq_res.page_len += sd->len;
......
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