Skip to content

Commit

Permalink
mm: Fix filemap_invalidate_inode() to use invalidate_inode_pages2_ran…
Browse files Browse the repository at this point in the history
…ge()

commit c26096e upstream.

Fix filemap_invalidate_inode() to use invalidate_inode_pages2_range()
rather than truncate_inode_pages_range().  The latter clears the
invalidated bit of a partial pages rather than discarding it entirely.
This causes copy_file_range() to fail on cifs because the partial pages at
either end of the destination range aren't evicted and reread, but rather
just partly cleared.

This causes generic/075 and generic/112 xfstests to fail.

Fixes: 74e797d ("mm: Provide a means of invalidation without using launder_folio")
Signed-off-by: David Howells <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
cc: Matthew Wilcox <[email protected]>
cc: Miklos Szeredi <[email protected]>
cc: Trond Myklebust <[email protected]>
cc: Christoph Hellwig <[email protected]>
cc: Andrew Morton <[email protected]>
cc: Alexander Viro <[email protected]>
cc: Christian Brauner <[email protected]>
cc: Jeff Layton <[email protected]>
cc: [email protected]
cc: [email protected]
cc: [email protected]
cc: [email protected]
cc: [email protected]
cc: [email protected]
cc: [email protected]
cc: [email protected]
cc: [email protected]
Signed-off-by: Christian Brauner <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
dhowells authored and gregkh committed Sep 8, 2024
1 parent ca32ee8 commit 9ce2784
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -4221,7 +4221,7 @@ int filemap_invalidate_inode(struct inode *inode, bool flush,
}

/* Wait for writeback to complete on all folios and discard. */
truncate_inode_pages_range(mapping, start, end);
invalidate_inode_pages2_range(mapping, start / PAGE_SIZE, end / PAGE_SIZE);

unlock:
filemap_invalidate_unlock(mapping);
Expand Down

0 comments on commit 9ce2784

Please sign in to comment.