Skip to contentSkip to conversation

netfs: Fix netfs_read_folio() to wait on writeback

PATCH Applied Suraj Jitindar Singh 2 participants 2 messages Sep 3 – Sep 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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).

---
 fs/netfs/buffered_read.c | 2 ++
 1 file changed, 2 insertions(+)
fs/netfs/buffered_read.c +2 -0
index d99284e35126..fd41e38aedb7 100644
@@ -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
maintainer Applied
#1 lore raw
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 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")

Queued for 6.12, thanks.

Signature · 2 lines
Thanks,
Sasha