From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: [for-linus][PATCH 8/8] eventfs: Do not use attributes for events directory
Date: Thu, 23 May 2024 17:23:06 -0400 [thread overview]
Message-ID: <20240523212407.210966757@goodmis.org> (raw)
In-Reply-To: 20240523212258.883756004@goodmis.org
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
The top "events" directory has a static inode (it's created when it is and
removed when the directory is removed). There's no need to use the events
ei->attr to determine its permissions. But it is used for saving the
permissions of the "events" directory for when it is created, as that is
needed for the default permissions for the files and directories
underneath it.
For example:
# cd /sys/kernel/tracing
# mkdir instances/foo
# chown 1001 instances/foo/events
The files under instances/foo/events should still have the same owner as
instances/foo (which the instances/foo/events ei->attr will hold), but the
events directory now has owner 1001.
Link: https://lore.kernel.org/lkml/20240522165032.104981011@goodmis.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
fs/tracefs/event_inode.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 320e49056d3a..5d88c184f0fc 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -210,7 +210,9 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,
* determined by the parent directory.
*/
if (dentry->d_inode->i_mode & S_IFDIR) {
- update_attr(&ei->attr, iattr);
+ /* Just use the inode permissions for the events directory */
+ if (!ei->is_events)
+ update_attr(&ei->attr, iattr);
} else {
name = dentry->d_name.name;
@@ -789,14 +791,12 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
uid = d_inode(dentry->d_parent)->i_uid;
gid = d_inode(dentry->d_parent)->i_gid;
- ei->attr.uid = uid;
- ei->attr.gid = gid;
-
/*
- * When the "events" directory is created, it takes on the
- * permissions of its parent. But can be reset on remount.
+ * The ei->attr will be used as the default values for the
+ * files beneath this directory.
*/
- ei->attr.mode |= EVENTFS_SAVE_UID | EVENTFS_SAVE_GID;
+ ei->attr.uid = uid;
+ ei->attr.gid = gid;
INIT_LIST_HEAD(&ei->children);
INIT_LIST_HEAD(&ei->list);
--
2.43.0
prev parent reply other threads:[~2024-05-23 21:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 21:22 [for-linus][PATCH 0/8] tracefs/eventfs: Fixes and cleanups for v6.10 Steven Rostedt
2024-05-23 21:22 ` [for-linus][PATCH 1/8] eventfs: Keep the directories from having the same inode number as files Steven Rostedt
2024-05-23 21:23 ` [for-linus][PATCH 2/8] tracefs: Update inode permissions on remount Steven Rostedt
2024-05-23 21:23 ` [for-linus][PATCH 3/8] eventfs: Update all the eventfs_inodes from the events descriptor Steven Rostedt
2024-05-23 21:23 ` [for-linus][PATCH 4/8] tracefs: Clear EVENT_INODE flag in tracefs_drop_inode() Steven Rostedt
2024-05-23 21:23 ` [for-linus][PATCH 5/8] eventfs: Consolidate the eventfs_inode update in eventfs_get_inode() Steven Rostedt
2024-05-23 21:23 ` [for-linus][PATCH 6/8] eventfs: Remove getattr and permission callbacks Steven Rostedt
2024-05-23 21:23 ` [for-linus][PATCH 7/8] eventfs: Cleanup permissions in creation of inodes Steven Rostedt
2024-05-23 21:23 ` Steven Rostedt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240523212407.210966757@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=masahiroy@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox