[RFC PATCH 03/18] fuse: don't move a folio with PG_rcu_free into a fuse file
From: Kiryl Shutsemau (Meta)
Date: Mon Oct 19 2026 - 14:10:02 EST
fuse_try_move_folio() takes the folio of a pipe buffer and puts it into
a fuse file, where writes change it. A folio with PG_rcu_free may still
be copied by a lockless page cache read that found it before it left
the page cache.
Such a folio reaches fuse when a mapped file page is gifted with
vmsplice(SPLICE_F_GIFT) and its file is then truncated.
fuse_check_folio() refuses it only because the flag is not among those
it allows, and with a dump_page().
Copy such a folio instead, as fuse does whenever it cannot take one.
Assisted-by: LLM
Signed-off-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
---
fs/fuse/dev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 4fec31fc0b84..526929c7b3f1 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1152,6 +1152,10 @@ static int fuse_try_move_folio(struct fuse_copy_state *cs, struct folio **foliop
newfolio = page_folio(buf->page);
+ /* A lockless page cache read may still be copying from it */
+ if (folio_test_rcu_free(newfolio))
+ goto out_fallback_unlock;
+
folio_clear_uptodate(newfolio);
folio_clear_mappedtodisk(newfolio);
--
2.54.0