Unverified Commit ded0c6f1 authored by David Howells's avatar David Howells Committed by Christian Brauner
Browse files

netfs: Fix netfs_read_folio() to wait on writeback

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: ee4cdf7b ("netfs: Speed up buffered reading")
Closes: https://sashiko.dev/#/patchset/20260414082004.3756080-1-dhowells%40redhat.com


Signed-off-by: default avatarDavid 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: default avatarChristian Brauner <brauner@kernel.org>
parent ccde2ac7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -503,6 +503,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))
		return netfs_read_gaps(file, folio);