mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] Make nfsd_splice_actor work with reads with a non-zero offset that doesn't end on a page boundary
@ 2022-11-23 17:50 Anders Blomdell
  2022-11-23 17:54 ` Chuck Lever III
  0 siblings, 1 reply; 2+ messages in thread
From: Anders Blomdell @ 2022-11-23 17:50 UTC (permalink / raw)
  To: Jeff Layton, Chuck Lever, Al Viro
  Cc: linux-nfs, linux-fsdevel, linux-kernel, stable

Make nfsd_splice_actor work with reads with a non-zero offset that doesn't end on a page boundary.

This was found when virtual machines with nfs-mounted qcow2 disks failed to boot properly (originally found
on v6.0.5, fix also needed and tested on v6.0.9 and v6.1-rc6).

Signed-off-by: Anders Blomdell <anders.blomdell@control.lth.se>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2142132
Fixes: bfbfb6182ad1 "nfsd_splice_actor(): handle compound pages"
Cc: stable@vger.kernel.org # v6.0+

--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -873,7 +873,7 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
         unsigned offset = buf->offset;
  
         page += offset / PAGE_SIZE;
-       for (int i = sd->len; i > 0; i -= PAGE_SIZE)
+       for (int i = sd->len + offset % PAGE_SIZE; i > 0; i -= PAGE_SIZE)
                 svc_rqst_replace_page(rqstp, page++);
         if (rqstp->rq_res.page_len == 0)        // first call
                 rqstp->rq_res.page_base = offset % PAGE_SIZE;


-- 
Anders Blomdell                  Email: anders.blomdell@control.lth.se
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118
SE-221 00 Lund, Sweden

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] Make nfsd_splice_actor work with reads with a non-zero offset that doesn't end on a page boundary
  2022-11-23 17:50 [PATCH 1/1] Make nfsd_splice_actor work with reads with a non-zero offset that doesn't end on a page boundary Anders Blomdell
@ 2022-11-23 17:54 ` Chuck Lever III
  0 siblings, 0 replies; 2+ messages in thread
From: Chuck Lever III @ 2022-11-23 17:54 UTC (permalink / raw)
  To: Anders Blomdell
  Cc: Jeff Layton, Al Viro, Linux NFS Mailing List, linux-fsdevel,
	linux-kernel, stable



> On Nov 23, 2022, at 12:50 PM, Anders Blomdell <anders.blomdell@control.lth.se> wrote:
> 
> Make nfsd_splice_actor work with reads with a non-zero offset that doesn't end on a page boundary.
> 
> This was found when virtual machines with nfs-mounted qcow2 disks failed to boot properly (originally found
> on v6.0.5, fix also needed and tested on v6.0.9 and v6.1-rc6).
> 
> Signed-off-by: Anders Blomdell <anders.blomdell@control.lth.se>
> Link: https://bugzilla.redhat.com/show_bug.cgi?id=2142132
> Fixes: bfbfb6182ad1 "nfsd_splice_actor(): handle compound pages"
> Cc: stable@vger.kernel.org # v6.0+
> 
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -873,7 +873,7 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
>        unsigned offset = buf->offset;
>         page += offset / PAGE_SIZE;
> -       for (int i = sd->len; i > 0; i -= PAGE_SIZE)
> +       for (int i = sd->len + offset % PAGE_SIZE; i > 0; i -= PAGE_SIZE)
>                svc_rqst_replace_page(rqstp, page++);
>        if (rqstp->rq_res.page_len == 0)        // first call
>                rqstp->rq_res.page_base = offset % PAGE_SIZE;

Thanks. I actually find Al's suggestion (posted in the other thread)
preferable. Can you test that and repost? I will then apply the fix
immediately to nfsd's for-rc tree.


--
Chuck Lever




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-23 17:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23 17:50 [PATCH 1/1] Make nfsd_splice_actor work with reads with a non-zero offset that doesn't end on a page boundary Anders Blomdell
2022-11-23 17:54 ` Chuck Lever III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®