[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175798162376.391272.5639186132451318153.stgit@frogsfrogsfrogs>
Date: Mon, 15 Sep 2025 18:03:57 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: miklos@...redi.hu, neal@...pa.dev, linux-fsdevel@...r.kernel.org,
linux-ext4@...r.kernel.org, John@...ves.net, bernd@...ernd.com,
joannelkoong@...il.com
Subject: [PATCH 02/10] fuse2fs: skip permission checking on utimens when iomap
is enabled
From: Darrick J. Wong <djwong@...nel.org>
When iomap is enabled, the kernel is in charge of enforcing permissions
checks on timestamp updates for files. We needn't do that in userspace
anymore.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
fuse4fs/fuse4fs.c | 11 +++++++----
misc/fuse2fs.c | 11 +++++++----
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/fuse4fs/fuse4fs.c b/fuse4fs/fuse4fs.c
index bc2cf41085695f..06be49164c783d 100644
--- a/fuse4fs/fuse4fs.c
+++ b/fuse4fs/fuse4fs.c
@@ -4850,13 +4850,16 @@ static int fuse4fs_utimens(struct fuse4fs *ff, const struct fuse_ctx *ctxt,
/*
* ext4 allows timestamp updates of append-only files but only if we're
- * setting to current time
+ * setting to current time. If iomap is enabled, the kernel does the
+ * permission checking for timestamp updates; skip the access check.
*/
if (aact == TA_NOW && mact == TA_NOW)
access |= A_OK;
- ret = fuse4fs_inum_access(ff, ctxt, ino, access);
- if (ret)
- return ret;
+ if (!fuse4fs_iomap_enabled(ff)) {
+ ret = fuse4fs_inum_access(ff, ctxt, ino, access);
+ if (ret)
+ return ret;
+ }
if (aact != TA_OMIT)
EXT4_INODE_SET_XTIME(i_atime, &atime, inode);
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 8f7194f4f815ee..716793b5fa485c 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -4500,13 +4500,16 @@ static int op_utimens(const char *path, const struct timespec ctv[2],
/*
* ext4 allows timestamp updates of append-only files but only if we're
- * setting to current time
+ * setting to current time. If iomap is enabled, the kernel does the
+ * permission checking for timestamp updates; skip the access check.
*/
if (ctv[0].tv_nsec == UTIME_NOW && ctv[1].tv_nsec == UTIME_NOW)
access |= A_OK;
- ret = check_inum_access(ff, ino, access);
- if (ret)
- goto out;
+ if (!fuse2fs_iomap_enabled(ff)) {
+ ret = check_inum_access(ff, ino, access);
+ if (ret)
+ goto out;
+ }
err = fuse2fs_read_inode(fs, ino, &inode);
if (err) {
Powered by blists - more mailing lists