Skip to content

Commit e5f3ec3

Browse files
committed
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
2 parents 644e952 + ac8db82 commit e5f3ec3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/nfsd/vfs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -871,10 +871,11 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
871871
struct svc_rqst *rqstp = sd->u.data;
872872
struct page *page = buf->page; // may be a compound one
873873
unsigned offset = buf->offset;
874+
struct page *last_page;
874875

875-
page += offset / PAGE_SIZE;
876-
for (int i = sd->len; i > 0; i -= PAGE_SIZE)
877-
svc_rqst_replace_page(rqstp, page++);
876+
last_page = page + (offset + sd->len - 1) / PAGE_SIZE;
877+
for (page += offset / PAGE_SIZE; page <= last_page; page++)
878+
svc_rqst_replace_page(rqstp, page);
878879
if (rqstp->rq_res.page_len == 0) // first call
879880
rqstp->rq_res.page_base = offset % PAGE_SIZE;
880881
rqstp->rq_res.page_len += sd->len;

0 commit comments

Comments
 (0)