From: David Howells <dhowells@xxxxxxxxxx> commit c26096ee0278c5e765009c5eee427bbafe6dc090 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: 74e797d79cf1 ("mm: Provide a means of invalidation without using launder_folio") Signed-off-by: David Howells <dhowells@xxxxxxxxxx> Link: https://lore.kernel.org/r/20240828210249.1078637-5-dhowells@xxxxxxxxxx cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> cc: Miklos Szeredi <miklos@xxxxxxxxxx> cc: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> cc: Christoph Hellwig <hch@xxxxxx> cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> cc: Christian Brauner <brauner@xxxxxxxxxx> cc: Jeff Layton <jlayton@xxxxxxxxxx> cc: linux-mm@xxxxxxxxx cc: linux-fsdevel@xxxxxxxxxxxxxxx cc: netfs@xxxxxxxxxxxxxxx cc: v9fs@xxxxxxxxxxxxxxx cc: linux-afs@xxxxxxxxxxxxxxxxxxx cc: ceph-devel@xxxxxxxxxxxxxxx cc: linux-cifs@xxxxxxxxxxxxxxx cc: linux-nfs@xxxxxxxxxxxxxxx cc: devel@xxxxxxxxxxxxxxxxxx Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/filemap.c +++ b/mm/filemap.c @@ -4221,7 +4221,7 @@ int filemap_invalidate_inode(struct inod } /* 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); Patches currently in stable-queue which might be from dhowells@xxxxxxxxxx are queue-6.10/mm-fix-filemap_invalidate_inode-to-use-invalidate_inode_pages2_range.patch