aboutsummaryrefslogtreecommitdiff
path: root/fs/nfsd
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org> 2022-11-26 12:25:49 -0800
committerGravatar Linus Torvalds <torvalds@linux-foundation.org> 2022-11-26 12:25:49 -0800
commite5f3ec38c8496dd7f6ada8a5e8d4958ef46ddb3f (patch)
tree48a50770f899bed84e7168402c9a7ba83e8c0de7 /fs/nfsd
parentMerge tag 'for-v6.1-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/... (diff)
parentNFSD: Fix reads with a non-zero offset that don't end on a page boundary (diff)
downloadlinux-e5f3ec38c8496dd7f6ada8a5e8d4958ef46ddb3f.tar.gz
linux-e5f3ec38c8496dd7f6ada8a5e8d4958ef46ddb3f.tar.bz2
linux-e5f3ec38c8496dd7f6ada8a5e8d4958ef46ddb3f.zip
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
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/vfs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index f650afedd67f..ac3c3844cfc6 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -871,10 +871,11 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
struct svc_rqst *rqstp = sd->u.data;
struct page *page = buf->page; // may be a compound one
unsigned offset = buf->offset;
+ struct page *last_page;
- page += offset / PAGE_SIZE;
- for (int i = sd->len; i > 0; i -= PAGE_SIZE)
- svc_rqst_replace_page(rqstp, page++);
+ last_page = page + (offset + sd->len - 1) / PAGE_SIZE;
+ for (page += offset / PAGE_SIZE; page <= last_page; page++)
+ svc_rqst_replace_page(rqstp, page);
if (rqstp->rq_res.page_len == 0) // first call
rqstp->rq_res.page_base = offset % PAGE_SIZE;
rqstp->rq_res.page_len += sd->len;