[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175573714410.22854.8959091723427645115.stgit@frogsfrogsfrogs>
Date: Wed, 20 Aug 2025 18:21:26 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: John@...ves.net, bernd@...ernd.com, linux-fsdevel@...r.kernel.org,
linux-ext4@...r.kernel.org, miklos@...redi.hu, joannelkoong@...il.com,
neal@...pa.dev
Subject: [PATCH 1/8] 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>
---
misc/fuse2fs.c | 11 +++++++----
misc/fuse4fs.c | 11 +++++++----
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 1b44b836484b14..95e850e3cd49f1 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -4609,13 +4609,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) {
diff --git a/misc/fuse4fs.c b/misc/fuse4fs.c
index df8da745fcd7c7..8d547e03f558df 100644
--- a/misc/fuse4fs.c
+++ b/misc/fuse4fs.c
@@ -4816,13 +4816,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);
Powered by blists - more mailing lists