netfs: Fix netfs_read_folio() to wait on writeback
Subsystems (3)
PATCH 1/1 netfs: Fix netfs_read_folio() to wait on writeback
From: David Howells <[email protected]>
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")
Signed-off-by David Howells <[email protected]>
cc Paulo Alcantara <[email protected]>
cc Matthew Wilcox <[email protected]>
Signed-off-by Christian Brauner <[email protected]>
Signed-off-by Suraj Jitindar Singh <[email protected]>
--- fs/netfs/buffered_read.c | 2 ++ 1 file changed, 2 insertions(+)
fs/netfs/buffered_read.c +2 -0
@@ -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);
Signature · 1 line
2.47.3
Quoted 6 lines
Fix
netfs_read_folio()to wait for an ongoing writeback to complete so that it can trust the dirty flag and whatever is attached tofolio->private(folio->privatemay get cleaned up by the collector before it clears the writeback flag).Fixes ee4cdf7ba857 ("netfs: Speed up buffered reading")
Queued for 6.12, thanks.
Signature · 2 lines
Thanks, Sasha