Skip to content

Commit d1221ce

Browse files
committed
Merge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull iov_iter fix from Al Viro: "Fix for a nfsd regression caused by the iov_iter stuff this window" * tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: nfsd_splice_actor(): handle compound pages
2 parents e839a75 + bfbfb61 commit d1221ce

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

fs/nfsd/vfs.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,10 +845,14 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
845845
struct splice_desc *sd)
846846
{
847847
struct svc_rqst *rqstp = sd->u.data;
848-
849-
svc_rqst_replace_page(rqstp, buf->page);
850-
if (rqstp->rq_res.page_len == 0)
851-
rqstp->rq_res.page_base = buf->offset;
848+
struct page *page = buf->page; // may be a compound one
849+
unsigned offset = buf->offset;
850+
851+
page += offset / PAGE_SIZE;
852+
for (int i = sd->len; i > 0; i -= PAGE_SIZE)
853+
svc_rqst_replace_page(rqstp, page++);
854+
if (rqstp->rq_res.page_len == 0) // first call
855+
rqstp->rq_res.page_base = offset % PAGE_SIZE;
852856
rqstp->rq_res.page_len += sd->len;
853857
return sd->len;
854858
}

0 commit comments

Comments
 (0)