[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260131165056.94142-1-ytohnuki@amazon.com>
Date: Sat, 31 Jan 2026 16:50:56 +0000
From: Yuto Ohnuki <ytohnuki@...zon.com>
To: Miklos Szeredi <miklos@...redi.hu>
CC: <linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>, "Yuto
Ohnuki" <ytohnuki@...zon.com>
Subject: [PATCH] fuse: update atime on DAX read
Address the TODO comment in fuse_dax_read_iter() which has been present
since the initial DAX implementation in commit c2d0ad00d948 ("virtiofs:
implement dax read/write operations").
Simply calling file_accessed() is insufficient for FUSE, as it only
updates the local inode without notifying the server.
This patch introduces fuse_flush_atime() to explicitly send atime
updates to the server via SETATTR, followed by fuse_invalidate_atime()
to invalidate the attribute cache.
Signed-off-by: Yuto Ohnuki <ytohnuki@...zon.com>
---
fs/fuse/dax.c | 4 +++-
fs/fuse/dir.c | 20 ++++++++++++++++++++
fs/fuse/fuse_i.h | 1 +
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
index ac6d4c1064cc..da7aa60c308a 100644
--- a/fs/fuse/dax.c
+++ b/fs/fuse/dax.c
@@ -688,7 +688,9 @@ ssize_t fuse_dax_read_iter(struct kiocb *iocb, struct iov_iter *to)
ret = dax_iomap_rw(iocb, to, &fuse_iomap_ops);
inode_unlock_shared(inode);
- /* TODO file_accessed(iocb->f_filp) */
+ file_accessed(iocb->ki_filp);
+ fuse_flush_atime(inode);
+ fuse_invalidate_atime(inode);
return ret;
}
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 4b6b3d2758ff..a919dc1ac6bc 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -2113,6 +2113,26 @@ int fuse_flush_times(struct inode *inode, struct fuse_file *ff)
return fuse_simple_request(fm, &args);
}
+/*
+ * Flush inode->i_atime to the server
+ */
+int fuse_flush_atime(struct inode *inode)
+{
+ struct fuse_mount *fm = get_fuse_mount(inode);
+ FUSE_ARGS(args);
+ struct fuse_setattr_in inarg;
+ struct fuse_attr_out outarg;
+
+ memset(&inarg, 0, sizeof(inarg));
+ memset(&outarg, 0, sizeof(outarg));
+
+ inarg.valid = FATTR_ATIME | FATTR_ATIME_NOW;
+
+ fuse_setattr_fill(fm->fc, &args, inode, &inarg, &outarg);
+
+ return fuse_simple_request(fm, &args);
+}
+
/*
* Set attributes, and at the same time refresh them.
*
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 7f16049387d1..553195ce707f 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -1467,6 +1467,7 @@ int fuse_dev_release(struct inode *inode, struct file *file);
bool fuse_write_update_attr(struct inode *inode, loff_t pos, ssize_t written);
int fuse_flush_times(struct inode *inode, struct fuse_file *ff);
+int fuse_flush_atime(struct inode *inode);
int fuse_write_inode(struct inode *inode, struct writeback_control *wbc);
int fuse_do_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
--
2.50.1
Amazon Web Services EMEA SARL, 38 avenue John F. Kennedy, L-1855 Luxembourg, R.C.S. Luxembourg B186284
Amazon Web Services EMEA SARL, Irish Branch, One Burlington Plaza, Burlington Road, Dublin 4, Ireland, branch registration number 908705
Powered by blists - more mailing lists