From nobody Wed Feb 11 11:31:02 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E359F7D3EF for ; Wed, 22 May 2024 16:49:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716396588; cv=none; b=sAhDUGsklcYXfIyEhcShtUJuqkQ/D/ijpWs6xBdwP1Q7qcPcgBm6m7csGdpb2e/IzbyqBvWp3ElzdR/Gg/Kno75Wd0nm1j+fzts4c9FVnmMe/k4KPZr72YaLIGNCg07uGgDmUueJDfSIDhAbMyQ8MseiT8pNDLW1eRbmb3S4FKI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716396588; c=relaxed/simple; bh=/KhFpgQrMtYdBgS18PjEezGY4NB0p3+yEjpcCoJWZLY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=VQP4GMlEZS4aHcPcGuaazhFA99ub4bi5K6SHS6O9lPPp5E32nVU7oBmKzjPTu9/tM7FStxYYC6krSSIDuTnjFbuC9CD4nNhkY/3HnKM43+gdeWHE2lbdfmOwJoVo6MxQ3ohhYrGQ+ia3EUcwG56EJipaAlVQMZkQy7jNIO0AFf4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91392C2BD11; Wed, 22 May 2024 16:49:48 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1s9pAd-00000006HPd-3C9y; Wed, 22 May 2024 12:50:31 -0400 Message-ID: <20240522165031.624864160@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 22 May 2024 12:49:43 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [PATCH 1/4] eventfs: Consolidate the eventfs_inode update in eventfs_get_inode() References: <20240522164942.590663963@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" To simplify the code, create a eventfs_get_inode() that is used when an eventfs file or directory is created. Have the internal tracefs_inode updated the appropriate flags in this function and update the inode's mode as well. Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/event_inode.c | 42 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 5dfb1ccd56ea..fb0fcd419805 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -394,6 +394,25 @@ static void update_inode_attr(struct dentry *dentry, s= truct inode *inode, inode->i_gid =3D attr->gid; } =20 +static struct inode *eventfs_get_inode(struct dentry *dentry, struct event= fs_attr *attr, + umode_t mode, struct eventfs_inode *ei) +{ + struct tracefs_inode *ti; + struct inode *inode; + + inode =3D tracefs_get_inode(dentry->d_sb); + if (!inode) + return NULL; + + ti =3D get_tracefs(inode); + ti->private =3D ei; + ti->flags |=3D TRACEFS_EVENT_INODE; + + update_inode_attr(dentry, inode, attr, mode); + + return inode; +} + /** * lookup_file - look up a file in the tracefs filesystem * @parent_ei: Pointer to the eventfs_inode that represents parent of the = file @@ -414,7 +433,6 @@ static struct dentry *lookup_file(struct eventfs_inode = *parent_ei, void *data, const struct file_operations *fop) { - struct tracefs_inode *ti; struct inode *inode; =20 if (!(mode & S_IFMT)) @@ -423,13 +441,11 @@ static struct dentry *lookup_file(struct eventfs_inod= e *parent_ei, if (WARN_ON_ONCE(!S_ISREG(mode))) return ERR_PTR(-EIO); =20 - inode =3D tracefs_get_inode(dentry->d_sb); + /* Only directories have ti->private set to an ei, not files */ + inode =3D eventfs_get_inode(dentry, attr, mode, NULL); if (unlikely(!inode)) return ERR_PTR(-ENOMEM); =20 - /* If the user updated the directory's attributes, use them */ - update_inode_attr(dentry, inode, attr, mode); - inode->i_op =3D &eventfs_file_inode_operations; inode->i_fop =3D fop; inode->i_private =3D data; @@ -437,9 +453,6 @@ static struct dentry *lookup_file(struct eventfs_inode = *parent_ei, /* All files will have the same inode number */ inode->i_ino =3D EVENTFS_FILE_INODE_INO; =20 - ti =3D get_tracefs(inode); - ti->flags |=3D TRACEFS_EVENT_INODE; - // Files have their parent's ei as their fsdata dentry->d_fsdata =3D get_ei(parent_ei); =20 @@ -459,28 +472,19 @@ static struct dentry *lookup_file(struct eventfs_inod= e *parent_ei, static struct dentry *lookup_dir_entry(struct dentry *dentry, struct eventfs_inode *pei, struct eventfs_inode *ei) { - struct tracefs_inode *ti; struct inode *inode; + umode_t mode =3D S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; =20 - inode =3D tracefs_get_inode(dentry->d_sb); + inode =3D eventfs_get_inode(dentry, &ei->attr, mode, ei); if (unlikely(!inode)) return ERR_PTR(-ENOMEM); =20 - /* If the user updated the directory's attributes, use them */ - update_inode_attr(dentry, inode, &ei->attr, - S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO); - inode->i_op =3D &eventfs_dir_inode_operations; inode->i_fop =3D &eventfs_file_operations; =20 /* All directories will have the same inode number */ inode->i_ino =3D eventfs_dir_ino(ei); =20 - ti =3D get_tracefs(inode); - ti->flags |=3D TRACEFS_EVENT_INODE; - /* Only directories have ti->private set to an ei, not files */ - ti->private =3D ei; - dentry->d_fsdata =3D get_ei(ei); =20 d_add(dentry, inode); --=20 2.43.0 From nobody Wed Feb 11 11:31:02 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59B261420CA for ; Wed, 22 May 2024 16:49:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716396589; cv=none; b=s5Q5VQK1C+RhRi8QWMLaJMwNrxoIXWMMJk5tnd3kq1PRKu2/fMX+48tUgKSLT3VTpqRxXbZjG3JZHn5jz+rg7WbRAElP1mSVT6LxcbJx/6XsN8WJzPpYkK+3cxrXx4peLxzhUDU4C0PCuOHTa1NUOm8VsRNN8D9Q3Pyp7kRRpgM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716396589; c=relaxed/simple; bh=V145cZNiWNCtXZ8E8drCo4cEY4Xy3jDEou2pmLZ7cPc=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=ovok/7NvlMkw4U/P2L6ObK1ie5g23/e3X0p4If+g3yC2zbJoHPSx9Du/DNWDmpAvtafNyimap7Qep+XpFZUDLnAvp57nOrSiqUD14epCQflm4UD9w3vtmnn9EKLZwv5SDaSUL5yYJ5WWqpPR3jZdFOb7wXjeGKbb1pIBKcMkrcQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF53CC4AF08; Wed, 22 May 2024 16:49:48 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1s9pAd-00000006HQ7-3s4t; Wed, 22 May 2024 12:50:31 -0400 Message-ID: <20240522165031.782066021@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 22 May 2024 12:49:44 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [PATCH 2/4] eventfs: Remove getattr and permission callbacks References: <20240522164942.590663963@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" 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). Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/event_inode.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index fb0fcd419805..4af6380eb236 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -250,49 +250,9 @@ static void update_events_attr(struct eventfs_inode *e= i, struct super_block *sb) ei->attr.gid =3D parent->i_gid; } =20 -static void set_top_events_ownership(struct inode *inode) -{ - struct tracefs_inode *ti =3D get_tracefs(inode); - struct eventfs_inode *ei =3D 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 =3D ei->attr.uid; - - if (!(ei->attr.mode & EVENTFS_SAVE_GID)) - inode->i_gid =3D 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 =3D path->dentry; - struct inode *inode =3D 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 =3D { .lookup =3D eventfs_root_lookup, .setattr =3D eventfs_set_attr, - .getattr =3D eventfs_get_attr, - .permission =3D eventfs_permission, }; =20 static const struct inode_operations eventfs_file_inode_operations =3D { --=20 2.43.0 From nobody Wed Feb 11 11:31:02 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2818B1420B8 for ; Wed, 22 May 2024 16:49:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716396589; cv=none; b=o3/nqK0QV0FcjRBXlodxGPzfnj5Sg2pCImQHaM0Ty9/TGZUvzdRpOECiRMqXWojneFC7YYfLEjXcTGalKs5izqqP33xQSqMkSnOnuYYxGxORn3TU04kJtMAEL5znr8zMXKMgZ0DHPBR9RKrU7tHY+46UfEVIvEmf59Q3hJtYoJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716396589; c=relaxed/simple; bh=l9Z6DFgD29WeqBvjguG0hgppQw2bePbeYrC8d3jD1M4=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=gZejMCy8QSAAdIMzalkHnnaJgj0kVxemoYXdGouAFxGjP42WP3cVYfetxHxajUQoV726/8WZLx/qI6na85wJLUZg51AfMdfBSyUBdD+yeXCtuFYSrjzbx1e2ivEPdAyd+J3GvfWFEbPZPF8XPmLy0Y9YkVPBLTSz7wy8ZVmtUUk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0840AC2BBFC; Wed, 22 May 2024 16:49:49 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1s9pAe-00000006HQb-0MLX; Wed, 22 May 2024 12:50:32 -0400 Message-ID: <20240522165031.944088388@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 22 May 2024 12:49:45 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [PATCH 3/4] eventfs: Cleanup permissions in creation of inodes References: <20240522164942.590663963@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" The permissions being set during the creation of the inodes was updating eventfs_inode attributes as well. Those attributes should only be touched by the setattr or remount operations, not during the creation of inodes. The eventfs_inode attributes should only be used to set the inodes and should not be modified during the inode creation. Simplify the code and fix the situation by: 1) Removing the eventfs_find_events() and doing a simple lookup for the events descriptor in eventfs_get_inode() 2) Remove update_events_attr() as the attributes should only be used to update the inode and should not be modified here. 3) Add update_inode_attr() that uses the attributes to determine what the inode permissions should be. 4) As the parent_inode of the eventfs_root_inode structure is no longer needed, remove it. Now on creation, the inode gets the proper permissions without causing side effects to the ei->attr field. Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/event_inode.c | 90 ++++++++++------------------------------ 1 file changed, 23 insertions(+), 67 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 4af6380eb236..7673532b5a5e 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -37,7 +37,6 @@ static DEFINE_MUTEX(eventfs_mutex); =20 struct eventfs_root_inode { struct eventfs_inode ei; - struct inode *parent_inode; struct dentry *events_dir; }; =20 @@ -229,27 +228,6 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, s= truct dentry *dentry, return ret; } =20 -static void update_events_attr(struct eventfs_inode *ei, struct super_bloc= k *sb) -{ - struct eventfs_root_inode *rei; - struct inode *parent; - - rei =3D get_root_inode(ei); - - /* Use the parent inode permissions unless root set its permissions */ - parent =3D rei->parent_inode; - - if (rei->ei.attr.mode & EVENTFS_SAVE_UID) - ei->attr.uid =3D rei->ei.attr.uid; - else - ei->attr.uid =3D parent->i_uid; - - if (rei->ei.attr.mode & EVENTFS_SAVE_GID) - ei->attr.gid =3D rei->ei.attr.gid; - else - ei->attr.gid =3D parent->i_gid; -} - static const struct inode_operations eventfs_dir_inode_operations =3D { .lookup =3D eventfs_root_lookup, .setattr =3D eventfs_set_attr, @@ -303,60 +281,30 @@ void eventfs_remount(struct tracefs_inode *ti, bool u= pdate_uid, bool update_gid) } } =20 -/* Return the evenfs_inode of the "events" directory */ -static struct eventfs_inode *eventfs_find_events(struct dentry *dentry) +static void update_inode_attr(struct inode *inode, umode_t mode, + struct eventfs_attr *attr, struct eventfs_root_inode *rei) { - struct eventfs_inode *ei; - - do { - // The parent is stable because we do not do renames - dentry =3D dentry->d_parent; - // ... and directories always have d_fsdata - ei =3D dentry->d_fsdata; - - /* - * If the ei is being freed, the ownership of the children - * doesn't matter. - */ - if (ei->is_freed) - return NULL; - - // Walk upwards until you find the events inode - } while (!ei->is_events); - - update_events_attr(ei, dentry->d_sb); - - return ei; -} - -static void update_inode_attr(struct dentry *dentry, struct inode *inode, - struct eventfs_attr *attr, umode_t mode) -{ - struct eventfs_inode *events_ei =3D eventfs_find_events(dentry); - - if (!events_ei) - return; - - inode->i_mode =3D mode; - inode->i_uid =3D events_ei->attr.uid; - inode->i_gid =3D events_ei->attr.gid; - - if (!attr) - return; - - if (attr->mode & EVENTFS_SAVE_MODE) + if (attr && attr->mode & EVENTFS_SAVE_MODE) inode->i_mode =3D attr->mode & EVENTFS_MODE_MASK; + else + inode->i_mode =3D mode; =20 - if (attr->mode & EVENTFS_SAVE_UID) + if (attr && attr->mode & EVENTFS_SAVE_UID) inode->i_uid =3D attr->uid; + else + inode->i_uid =3D rei->ei.attr.uid; =20 - if (attr->mode & EVENTFS_SAVE_GID) + if (attr && attr->mode & EVENTFS_SAVE_GID) inode->i_gid =3D attr->gid; + else + inode->i_gid =3D rei->ei.attr.gid; } =20 static struct inode *eventfs_get_inode(struct dentry *dentry, struct event= fs_attr *attr, umode_t mode, struct eventfs_inode *ei) { + struct eventfs_root_inode *rei; + struct eventfs_inode *pei; struct tracefs_inode *ti; struct inode *inode; =20 @@ -368,7 +316,16 @@ static struct inode *eventfs_get_inode(struct dentry *= dentry, struct eventfs_att ti->private =3D ei; ti->flags |=3D TRACEFS_EVENT_INODE; =20 - update_inode_attr(dentry, inode, attr, mode); + /* Find the top dentry that holds the "events" directory */ + do { + dentry =3D dentry->d_parent; + /* Directories always have d_fsdata */ + pei =3D dentry->d_fsdata; + } while (!pei->is_events); + + rei =3D get_root_inode(pei); + + update_inode_attr(inode, mode, attr, rei); =20 return inode; } @@ -805,7 +762,6 @@ struct eventfs_inode *eventfs_create_events_dir(const c= har *name, struct dentry // Note: we have a ref to the dentry from tracefs_start_creating() rei =3D get_root_inode(ei); rei->events_dir =3D dentry; - rei->parent_inode =3D d_inode(dentry->d_sb->s_root); =20 ei->entries =3D entries; ei->nr_entries =3D size; --=20 2.43.0 From nobody Wed Feb 11 11:31:02 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83B861422A1 for ; Wed, 22 May 2024 16:49:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716396589; cv=none; b=mXvjQd+SF9VrsGVR3Z2Ht37nXr0Jn+WjB5HpVtVH/BYy/v72QkSDBS3eZYh/Khuc47J7O21p2FCDzk50ZhC/YbgBb588jeB03Q6VmoJN0rAWHGL+ZSSVMWaoJEGmWbaC6m5/Lx+R/Yyc0n06vw6TUehfqUNRb54FduKTl+JsmBg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716396589; c=relaxed/simple; bh=uIxQswDa2bRMRBkm77tAVcu1ddz6P92wB9mR3/YA8tA=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=gmm0jqTPdU3RmiClto0qekstFSNHebuqvrzbX0pqFTMp2ZJzZz/2rOqesa8NNqgIQDTpIxJLvL9safvGrgX2M4koeVKNRi1VB2AiF1GQ5wSVpxs+0fAXxAZOfVbj7MMOfGlZLt5XToR2MLqwOEqy8beyX/3RjRNOWdfn+R8qkbc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F680C4AF07; Wed, 22 May 2024 16:49:49 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1s9pAe-00000006HR5-11LF; Wed, 22 May 2024 12:50:32 -0400 Message-ID: <20240522165032.104981011@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 22 May 2024 12:49:46 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [PATCH 4/4] eventfs: Do not use attributes for events directory References: <20240522164942.590663963@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" 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. Signed-off-by: Steven Rostedt (Google) --- 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 7673532b5a5e..40277d3dbf73 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, st= ruct 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); =20 } else { name =3D dentry->d_name.name; @@ -771,14 +773,12 @@ struct eventfs_inode *eventfs_create_events_dir(const= char *name, struct dentry uid =3D d_inode(dentry->d_parent)->i_uid; gid =3D d_inode(dentry->d_parent)->i_gid; =20 - ei->attr.uid =3D uid; - ei->attr.gid =3D 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 |=3D EVENTFS_SAVE_UID | EVENTFS_SAVE_GID; + ei->attr.uid =3D uid; + ei->attr.gid =3D gid; =20 INIT_LIST_HEAD(&ei->children); INIT_LIST_HEAD(&ei->list); --=20 2.43.0