NFS: nfs_invalidate_folio() must observe the offset and size arguments
[ Upstream commitb7b8574225
] 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:d47992f86b
("mm: change invalidatepage prototype to accept length") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e1651ba799
commit
b7c6c76c85
|
@ -437,9 +437,10 @@ 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 */
|
||||
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);
|
||||
|
|
|
@ -2058,6 +2058,7 @@ int nfs_wb_folio_cancel(struct inode *inode, struct folio *folio)
|
|||
* release it */
|
||||
nfs_inode_remove_request(req);
|
||||
nfs_unlock_and_release_request(req);
|
||||
folio_cancel_dirty(folio);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue