]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
eventfs: Remove getattr and permission callbacks
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 22 May 2024 16:49:44 +0000 (12:49 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 23 May 2024 13:27:25 +0000 (09:27 -0400)
Now that inodes have their permissions updated on remount, the only other
places to update the inode permissions are when they are created and in
the setattr callback. The getattr and permission callbacks are not needed
as the inodes should already be set at their proper settings.

Remove the callbacks, as it not only simplifies the code, but also allows
more flexibility to fix the inconsistencies with various corner cases
(like changing the permission of an instance directory).

Link: https://lore.kernel.org/lkml/20240522165031.782066021@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

index 92987b5c8d9d609a0fdbc91d72d5111653222b25..f32c6f7eb29fd49448973e23eafe4f82cd727b3a 100644 (file)
@@ -250,49 +250,9 @@ static void update_events_attr(struct eventfs_inode *ei, struct super_block *sb)
                ei->attr.gid = parent->i_gid;
 }
 
-static void set_top_events_ownership(struct inode *inode)
-{
-       struct tracefs_inode *ti = get_tracefs(inode);
-       struct eventfs_inode *ei = ti->private;
-
-       /* The top events directory doesn't get automatically updated */
-       if (!ei || !ei->is_events)
-               return;
-
-       update_events_attr(ei, inode->i_sb);
-
-       if (!(ei->attr.mode & EVENTFS_SAVE_UID))
-               inode->i_uid = ei->attr.uid;
-
-       if (!(ei->attr.mode & EVENTFS_SAVE_GID))
-               inode->i_gid = ei->attr.gid;
-}
-
-static int eventfs_get_attr(struct mnt_idmap *idmap,
-                           const struct path *path, struct kstat *stat,
-                           u32 request_mask, unsigned int flags)
-{
-       struct dentry *dentry = path->dentry;
-       struct inode *inode = d_backing_inode(dentry);
-
-       set_top_events_ownership(inode);
-
-       generic_fillattr(idmap, request_mask, inode, stat);
-       return 0;
-}
-
-static int eventfs_permission(struct mnt_idmap *idmap,
-                             struct inode *inode, int mask)
-{
-       set_top_events_ownership(inode);
-       return generic_permission(idmap, inode, mask);
-}
-
 static const struct inode_operations eventfs_dir_inode_operations = {
        .lookup         = eventfs_root_lookup,
        .setattr        = eventfs_set_attr,
-       .getattr        = eventfs_get_attr,
-       .permission     = eventfs_permission,
 };
 
 static const struct inode_operations eventfs_file_inode_operations = {