David Howells 0aa2e1b2fb
mm: Fix missing folio invalidation calls during truncation
When AS_RELEASE_ALWAYS is set on a mapping, the ->release_folio() and
->invalidate_folio() calls should be invoked even if PG_private and
PG_private_2 aren't set.  This is used by netfslib to keep track of the
point above which reads can be skipped in favour of just zeroing pagecache
locally.

There are a couple of places in truncation in which invalidation is only
called when folio_has_private() is true.  Fix these to check
folio_needs_release() instead.

Without this, the generic/075 and generic/112 xfstests (both fsx-based
tests) fail with minimum folio size patches applied[1].

Fixes: b4fa966f03b7 ("mm, netfs, fscache: stop read optimisation when folio removed from pagecache")
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20240815090849.972355-1-kernel@pankajraghav.com/ [1]
Link: https://lore.kernel.org/r/20240823200819.532106-2-dhowells@redhat.com
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
cc: Matthew Wilcox (Oracle) <willy@infradead.org>
cc: Pankaj Raghav <p.raghav@samsung.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: netfs@lists.linux.dev
cc: linux-mm@kvack.org
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-08-24 16:09:16 +02:00
..
2024-07-10 12:14:54 -07:00
2024-07-03 19:29:59 -07:00
2024-07-12 15:52:19 -07:00
2023-12-12 10:11:32 +01:00
2023-04-12 17:36:23 -07:00
2024-07-18 14:48:11 -07:00
2022-10-03 14:02:43 -07:00
2024-07-03 19:30:17 -07:00
2024-08-15 22:16:13 -07:00
2024-08-15 22:16:14 -07:00
2024-07-12 15:52:19 -07:00
2024-07-10 12:14:54 -07:00
2024-07-10 12:14:54 -07:00
2021-05-07 00:26:35 -07:00
2024-08-15 22:16:14 -07:00
2023-04-12 17:36:23 -07:00
2024-08-15 22:16:14 -07:00
2024-04-25 20:55:48 -07:00
2024-04-25 20:55:48 -07:00
2024-04-25 20:55:48 -07:00
2024-07-17 21:08:55 -07:00