Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH 6.12.y] netfs: Fix netfs_read_folio() to wait on writeback
@ 2026-09-03 22:34 Suraj Jitindar Singh
  0 siblings, 0 replies; only message in thread
From: Suraj Jitindar Singh @ 2026-09-03 22:34 UTC (permalink / raw)
  To: stable
  Cc: David Howells, Jeff Layton, Christian Brauner, netfs,
	linux-fsdevel, Paulo Alcantara, Matthew Wilcox

From: David Howells <dhowells@redhat.com>

commit ded0c6f1606061148c202825f7e53d711f9f84cf upstream.

Fix netfs_read_folio() to wait for an ongoing writeback to complete so that
it can trust the dirty flag and whatever is attached to folio->private
(folio->private may get cleaned up by the collector before it clears the
writeback flag).

Fixes: ee4cdf7ba857 ("netfs: Speed up buffered reading")
Closes: https://sashiko.dev/#/patchset/20260414082004.3756080-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://patch.msgid.link/20260512123404.719402-23-dhowells@redhat.com
cc: Paulo Alcantara <pc@manguebit.org>
cc: Matthew Wilcox <willy@infradead.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com>
---
 fs/netfs/buffered_read.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c
index d99284e35126..fd41e38aedb7 100644
--- a/fs/netfs/buffered_read.c
+++ b/fs/netfs/buffered_read.c
@@ -565,6 +565,8 @@ int netfs_read_folio(struct file *file, struct folio *folio)
 	struct netfs_inode *ctx = netfs_inode(mapping->host);
 	int ret;
 
+	folio_wait_writeback(folio);
+
 	if (folio_test_dirty(folio)) {
 		trace_netfs_folio(folio, netfs_folio_trace_read_gaps);
 		return netfs_read_gaps(file, folio);
-- 
2.47.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-03 22:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03 22:34 [PATCH 6.12.y] netfs: Fix netfs_read_folio() to wait on writeback Suraj Jitindar Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox