summaryrefslogtreecommitdiff
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2025-09-03 11:48:57 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2025-09-06 16:51:26 -0400
commitb7b8574225e9d2b5f1fb5483886ab797892f43b5 (patch)
tree2924b4420caa76576c7c050f29e03e21870b857c /fs/nfs/file.c
parentca247c89900ae90207f4d321e260cd93b7c7d104 (diff)
NFS: nfs_invalidate_folio() must observe the offset and size arguments
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>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index a3105f944a0e..8059ece82468 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -475,10 +475,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);
}