Re: [for-linus][PATCH 09/13] tracefs: Set the group ownership in apply_options() not parse_options()
From: Al Viro
Date: Fri Feb 25 2022 - 12:11:08 EST
On Fri, Feb 25, 2022 at 11:52:00AM -0500, Steven Rostedt wrote:
> @@ -293,6 +292,9 @@ static int tracefs_apply_options(struct super_block *sb)
> inode->i_uid = opts->uid;
> inode->i_gid = opts->gid;
>
> + if (tracefs_mount && tracefs_mount->mnt_root)
> + set_gid(tracefs_mount->mnt_root, opts->gid);
> +
Umm... Why bother with tracefs_mount here in the first place?
You have the superblock the operation is applied for - right in the
arguments.
Just make that
set_gid(sb->s_root, opts->gid);
and be done with that. Same place in tracefs_apply_options()...
Incidentally, I'm not sure you need to keep ->i_gid assignment - set_gid()
won't miss that inode, so...