mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
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: d47992f86b ("mm: change invalidatepage prototype to accept length")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
ca247c8990
commit
b7b8574225
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2045,6 +2045,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
Block a user