diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2025-09-03 11:48:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-09-19 16:37:28 +0200 |
commit | fc3bc5d2490298c38263d043db71a1521d5591dd (patch) | |
tree | 36409c3f061544628dd65debdd7d7fd26d03a22e /fs/nfs/file.c | |
parent | 5ae2ee9e1cd67de834b2dc60397304ac24a84817 (diff) |
NFS: nfs_invalidate_folio() must observe the offset and size arguments
[ Upstream commit b7b8574225e9d2b5f1fb5483886ab797892f43b5 ]
If we're truncating part of the folio, then we need to write out the
data on the part that is not covered by the cancellation.
Fixes: d47992f86b30 ("mm: change invalidatepage prototype to accept length")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r-- | fs/nfs/file.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 033feeab8c34..a16a619fb8c3 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -437,10 +437,11 @@ static void nfs_invalidate_folio(struct folio *folio, size_t offset, dfprintk(PAGECACHE, "NFS: invalidate_folio(%lu, %zu, %zu)\n", folio->index, offset, length); - if (offset != 0 || length < folio_size(folio)) - return; /* Cancel any unstarted writes on this page */ - nfs_wb_folio_cancel(inode, folio); + if (offset != 0 || length < folio_size(folio)) + nfs_wb_folio(inode, folio); + else + nfs_wb_folio_cancel(inode, folio); folio_wait_private_2(folio); /* [DEPRECATED] */ trace_nfs_invalidate_folio(inode, folio_pos(folio) + offset, length); } |