summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2024-08-23 21:08:11 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-09-04 13:30:04 +0200
commitc7c90666e43e7a991f6ad0ec4b3f406b3c2f91be (patch)
tree7d66712b336eff421230b73efc938e9d21e948ce /fs
parent875458893425cbd508d49326c2aa332b2afb1c83 (diff)
netfs: Fix netfs_release_folio() to say no if folio dirty
[ Upstream commit 7dfc8f0c6144c290dbeb01835a67e81b34dda8cd ] Fix netfs_release_folio() to say no (ie. return false) if the folio is dirty (analogous with iomap's behaviour). Without this, it will say yes to the release of a dirty page by split_huge_page_to_list_to_order(), which will result in the loss of untruncated data in the folio. Without this, the generic/075 and generic/112 xfstests (both fsx-based tests) fail with minimum folio size patches applied[1]. Fixes: c1ec4d7c2e13 ("netfs: Provide invalidate_folio and release_folio calls") 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-4-dhowells@redhat.com 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/netfs/misc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/netfs/misc.c b/fs/netfs/misc.c
index 607a1972f456..21acf4b092a4 100644
--- a/fs/netfs/misc.c
+++ b/fs/netfs/misc.c
@@ -161,6 +161,9 @@ bool netfs_release_folio(struct folio *folio, gfp_t gfp)
struct netfs_inode *ctx = netfs_inode(folio_inode(folio));
unsigned long long end;
+ if (folio_test_dirty(folio))
+ return false;
+
end = folio_pos(folio) + folio_size(folio);
if (end > ctx->zero_point)
ctx->zero_point = end;