From: Anders Blomdell <anders.blomdell@control.lth.se>
To: Jeff Layton <jlayton@kernel.org>,
Chuck Lever <chuck.lever@oracle.com>,
"Al Viro" <viro@zeniv.linux.org.uk>
Cc: <linux-nfs@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: [PATCH v2 1/1] Make nfsd_splice_actor work with reads with a non-zero offset that doesn't end on a page boundary
Date: Wed, 23 Nov 2022 20:00:10 +0100 [thread overview]
Message-ID: <9e45fed2-f9e9-8c5e-3c33-993de330f11e@control.lth.se> (raw)
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
@@ -869,12 +869,13 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
struct splice_desc *sd)
{
struct svc_rqst *rqstp = sd->u.data;
- struct page *page = buf->page; // may be a compound one
+ // buf->page may be a compound one
unsigned offset = buf->offset;
+ struct page *first = buf->page + offset / PAGE_SIZE;
+ struct page *last = buf->page + (offset + sd->len - 1) / PAGE_SIZE;
- page += offset / PAGE_SIZE;
- for (int i = sd->len; i > 0; i -= PAGE_SIZE)
- svc_rqst_replace_page(rqstp, page++);
+ for (struct page *page = first; page <= last; 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;
--
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
next reply other threads:[~2022-11-23 19:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 19:00 Anders Blomdell [this message]
2022-11-24 18:31 ` [PATCH v2 1/1] Make nfsd_splice_actor work with reads with a non-zero offset that doesn't end on a page boundary Chuck Lever III
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9e45fed2-f9e9-8c5e-3c33-993de330f11e@control.lth.se \
--to=anders.blomdell@control.lth.se \
--cc=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).