[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175798162412.391272.11129523293683525156.stgit@frogsfrogsfrogs>
Date: Mon, 15 Sep 2025 18:04:29 -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 04/10] fuse2fs: better debugging for file mode updates
From: Darrick J. Wong <djwong@...nel.org>
Improve the tracing of a chmod operation so that we can debug file mode
updates.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
fuse4fs/fuse4fs.c | 10 ++++++----
misc/fuse2fs.c | 12 +++++++-----
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/fuse4fs/fuse4fs.c b/fuse4fs/fuse4fs.c
index 184066855517b1..ab807f1479870c 100644
--- a/fuse4fs/fuse4fs.c
+++ b/fuse4fs/fuse4fs.c
@@ -3495,6 +3495,7 @@ static int fuse4fs_chmod(struct fuse4fs *ff, fuse_req_t req, ext2_ino_t ino,
mode_t mode, struct ext2_inode_large *inode)
{
const struct fuse_ctx *ctxt = fuse_req_ctx(req);
+ mode_t new_mode;
int ret = 0;
dbg_printf(ff, "%s: ino=%d mode=0%o\n", __func__, ino, mode);
@@ -3521,11 +3522,12 @@ static int fuse4fs_chmod(struct fuse4fs *ff, fuse_req_t req, ext2_ino_t ino,
mode &= ~S_ISGID;
}
- inode->i_mode &= ~0xFFF;
- inode->i_mode |= mode & 0xFFF;
+ new_mode = (inode->i_mode & ~0xFFF) | (mode & 0xFFF);
- dbg_printf(ff, "%s: ino=%d new_mode=0%o\n",
- __func__, ino, inode->i_mode);
+ dbg_printf(ff, "%s: ino=%d old_mode=0%o new_mode=0%o\n",
+ __func__, ino, inode->i_mode, new_mode);
+
+ inode->i_mode = new_mode;
return 0;
}
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 2b3c09a59270bc..53adf8542e2f42 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -3184,6 +3184,7 @@ static int op_chmod(const char *path, mode_t mode, struct fuse_file_info *fi)
errcode_t err;
ext2_ino_t ino;
struct ext2_inode_large inode;
+ mode_t new_mode;
int ret = 0;
FUSE2FS_CHECK_CONTEXT(ff);
@@ -3222,11 +3223,12 @@ static int op_chmod(const char *path, mode_t mode, struct fuse_file_info *fi)
mode &= ~S_ISGID;
}
- inode.i_mode &= ~0xFFF;
- inode.i_mode |= mode & 0xFFF;
+ new_mode = (inode.i_mode & ~0xFFF) | (mode & 0xFFF);
- dbg_printf(ff, "%s: path=%s new_mode=0%o ino=%d\n", __func__,
- path, inode.i_mode, ino);
+ dbg_printf(ff, "%s: path=%s old_mode=0%o new_mode=0%o ino=%d\n",
+ __func__, path, inode.i_mode, new_mode, ino);
+
+ inode.i_mode = new_mode;
ret = update_ctime(fs, ino, &inode);
if (ret)
@@ -3246,12 +3248,12 @@ static int op_chmod(const char *path, mode_t mode, struct fuse_file_info *fi)
static int op_chown(const char *path, uid_t owner, gid_t group,
struct fuse_file_info *fi)
{
+ struct ext2_inode_large inode;
struct fuse_context *ctxt = fuse_get_context();
struct fuse2fs *ff = fuse2fs_get();
ext2_filsys fs;
errcode_t err;
ext2_ino_t ino;
- struct ext2_inode_large inode;
int ret = 0;
FUSE2FS_CHECK_CONTEXT(ff);
Powered by blists - more mailing lists