[PATCH 28/28] fuse: disable direct reclaim for any fuse server that uses iomap

Darrick J. Wong
2025-09-16T00:35:16Z

Any fuse server that uses iomap can create a substantial amount of dirty
pages in the pagecache because we don't write dirty stuff until reclaim
or fsync. Therefore, memory reclaim on any fuse iomap server musn't
ever recurse back into the same filesystem. We must also never throttle
the fuse server writes to a bdi because that will just slow down
metadata operations.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
fs/fuse/file_iomap.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/fs/fuse/file_iomap.c b/fs/fuse/file_iomap.c
index 30db4079ab8a55..524c26e53674f2 100644
--- a/fs/fuse/file_iomap.c
+++ b/fs/fuse/file_iomap.c
@@ -1014,6 +1014,12 @@ static void fuse_iomap_config_reply(struct fuse_mount *fm,
fc->iomap_conn.no_end = 0;
fc->iomap_conn.no_ioend = 0;

+ /*
+ * We could be on the hook for a substantial amount of writeback, so
+ * prohibit reclaim from recursing into fuse or the kernel from
+ * throttling any bdis that the fuse server might write to.
+ */
+ current->flags |= PF_MEMALLOC_NOFS | PF_LOCAL_THROTTLE;
done:
kfree(ia);
fuse_finish_init(fc, ok);