From: Trond Myklebust <trondmy@hammerspace.com>
To: "bcodding@redhat.com" <bcodding@redhat.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"anna.schumaker@netapp.com" <anna.schumaker@netapp.com>
Subject: Re: [PATCH 1/3] NFSv42: Fix pagecache invalidation after COPY/CLONE
Date: Tue, 16 Nov 2021 15:26:56 +0000 [thread overview]
Message-ID: <da18020922e8daaa39f8fe78e891b5ec3267e6d0.camel@hammerspace.com> (raw)
In-Reply-To: <01F85A5B-483C-41B4-8D3E-0CD6209232C6@redhat.com>
On Tue, 2021-11-16 at 09:06 -0500, Benjamin Coddington wrote:
> On 16 Nov 2021, at 9:01, Benjamin Coddington wrote:
>
> > On 16 Nov 2021, at 8:57, Trond Myklebust wrote:
> >
> > > On Tue, 2021-11-16 at 08:49 -0500, Benjamin Coddington wrote:
> > > > The mechanism in use to allow the client to see the results of
> > > > COPY/CLONE
> > > > is to drop those pages from the pagecache. This forces the
> > > > client
> > > > to
> > > > read
> > > > those pages once more from the server. However,
> > > > truncate_pagecache_range()
> > > > zeros out partial pages instead of dropping them. Let us
> > > > instead
> > > > use
> > > > invalidate_inode_pages2_range() with full-page offsets to
> > > > ensure the
> > > > client
> > > > properly sees the results of COPY/CLONE operations.
> > > >
> > > > Cc: <stable@vger.kernel.org> # v4.7+
> > > > Fixes: 2e72448b07dc ("NFS: Add COPY nfs operation")
> > > > Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> > > > ---
> > > > fs/nfs/nfs42proc.c | 5 ++++-
> > > > 1 file changed, 4 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
> > > > index a24349512ffe..bbcd4c80c5a6 100644
> > > > --- a/fs/nfs/nfs42proc.c
> > > > +++ b/fs/nfs/nfs42proc.c
> > > > @@ -285,7 +285,10 @@ static void nfs42_copy_dest_done(struct
> > > > inode
> > > > *inode, loff_t pos, loff_t len)
> > > > loff_t newsize = pos + len;
> > > > loff_t end = newsize - 1;
> > > >
> > > > - truncate_pagecache_range(inode, pos, end);
> > > > + int error =
> > > > invalidate_inode_pages2_range(inode->i_mapping,
> > > > + pos
> > > > > > PAGE_SHIFT, end >>
> > > > PAGE_SHIFT);
> > >
> > > Shouldn't that be "(end + PAGE_SIZE - 1) >> PAGE_SHIFT" in order
> > > to
> > > align to the set of pages that fully contains the byte range from
> > > pos
> > > to end?
> >
> > It's embarrassing that I've messed that up, I will resend it.
>
> I've had it sitting around a bit too long -- on a second look no, it
> should
> be right because invalidate_inode_pages2_range()'s index arguments
> are
> inclusive.
>
OK, but can you resend without the unnecessary attribute declaration?
WARN_ON_ONCE(invalidate_inode_pages(...)) should be good enough.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
next prev parent reply other threads:[~2021-11-16 15:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-16 13:49 [PATCH 0/3] COPY/CLONE pagecache invalidation Benjamin Coddington
2021-11-16 13:49 ` [PATCH 1/3] NFSv42: Fix pagecache invalidation after COPY/CLONE Benjamin Coddington
2021-11-16 13:57 ` Trond Myklebust
2021-11-16 14:01 ` Benjamin Coddington
2021-11-16 14:06 ` Benjamin Coddington
2021-11-16 15:26 ` Trond Myklebust [this message]
2021-11-16 13:49 ` [PATCH 2/3] NFSv42: Don't drop NFS_INO_INVALID_CHANGE if we hold a delegation Benjamin Coddington
2021-11-16 14:03 ` Trond Myklebust
2021-11-16 14:12 ` Benjamin Coddington
2021-11-16 14:17 ` Trond Myklebust
2021-11-16 14:34 ` Benjamin Coddington
2021-11-16 14:49 ` Trond Myklebust
2021-11-16 15:15 ` Benjamin Coddington
2021-11-16 13:49 ` [PATCH 3/3] NFS: Add a tracepoint to show the results of nfs_set_cache_invalid() Benjamin Coddington
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=da18020922e8daaa39f8fe78e891b5ec3267e6d0.camel@hammerspace.com \
--to=trondmy@hammerspace.com \
--cc=anna.schumaker@netapp.com \
--cc=bcodding@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/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