From: Trond Myklebust <trondmy@hammerspace.com>
To: "bcodding@redhat.com" <bcodding@redhat.com>,
"anna.schumaker@netapp.com" <anna.schumaker@netapp.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 1/3] NFSv42: Fix pagecache invalidation after COPY/CLONE
Date: Tue, 16 Nov 2021 13:57:12 +0000 [thread overview]
Message-ID: <6dbcb2f39dcee7314bf772aaabf4923104ec7aee.camel@hammerspace.com> (raw)
In-Reply-To: <8b8ccdb69af2473eef4a36968894e7aee34d5851.1637069577.git.bcodding@redhat.com>
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?
> + WARN_ON_ONCE(error);
> +
> spin_lock(&inode->i_lock);
> if (newsize > i_size_read(inode))
> i_size_write(inode, newsize);
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
next prev parent reply other threads:[~2021-11-16 13:57 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 [this message]
2021-11-16 14:01 ` Benjamin Coddington
2021-11-16 14:06 ` Benjamin Coddington
2021-11-16 15:26 ` Trond Myklebust
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=6dbcb2f39dcee7314bf772aaabf4923104ec7aee.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