[PATCH 10/10] fuse4fs: increase attribute timeout in iomap mode

Darrick J. Wong
2026-04-29T15:01:14Z

In iomap mode, we trust the kernel to cache file attributes, because it
is critical to keep all of the file IO permissions checking in the
kernel as part of keeping all the file IO paths in the kernel.
Therefore, increase the attribute timeout to 30 seconds to reduce the
number of upcalls even further.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
fuse4fs/fuse4fs.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/fuse4fs/fuse4fs.c b/fuse4fs/fuse4fs.c
index b4105333f4fe22..9f7fe365ccdf87 100644
--- a/fuse4fs/fuse4fs.c
+++ b/fuse4fs/fuse4fs.c
@@ -131,7 +131,8 @@
#endif
#endif /* !defined(ENODATA) */

-#define FUSE4FS_ATTR_TIMEOUT (0.0)
+#define FUSE4FS_IOMAP_ATTR_TIMEOUT (0.0)
+#define FUSE4FS_ATTR_TIMEOUT (30.0)

#ifndef O_DIRECT
# define O_DIRECT (0)
@@ -2437,8 +2438,14 @@ static int fuse4fs_stat_inode(struct fuse4fs *ff, ext2_ino_t ino,

fuse4fs_ino_to_fuse(ff, &entry->ino, ino);
entry->generation = inodep->i_generation;
- entry->attr_timeout = FUSE4FS_ATTR_TIMEOUT;
- entry->entry_timeout = FUSE4FS_ATTR_TIMEOUT;
+
+ if (fuse4fs_iomap_enabled(ff)) {
+ entry->attr_timeout = FUSE4FS_IOMAP_ATTR_TIMEOUT;
+ entry->entry_timeout = FUSE4FS_IOMAP_ATTR_TIMEOUT;
+ } else {
+ entry->attr_timeout = FUSE4FS_ATTR_TIMEOUT;
+ entry->entry_timeout = FUSE4FS_ATTR_TIMEOUT;
+ }

fstat->iflags = 0;

@@ -2671,6 +2678,8 @@ static void op_statx(fuse_req_t req, fuse_ino_t fino, int flags, int mask,
fuse4fs_finish(ff, ret);
if (ret)
fuse_reply_err(req, -ret);
+ else if (fuse4fs_iomap_enabled(ff))
+ fuse_reply_statx(req, 0, &stx, FUSE4FS_IOMAP_ATTR_TIMEOUT);
else
fuse_reply_statx(req, 0, &stx, FUSE4FS_ATTR_TIMEOUT);
}