From nobody Fri Jun 19 09:04:59 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 0BE56296BAF for ; Thu, 9 Apr 2026 18:34:02 +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=1775759642; cv=none; b=JqC0E1P6StYKFS5OGniiH5tY732ABpDy01Fc24rh2fU96Uw2wXAmjt9lZf+TwItlg6Vih+TgtLESFblcQXpKOh3YbkUuTCSVStkrZ11jYAVSONluTLnJHm3KEN2M5Mo/C7GADMkgSo6S/OrOd/IOkEuAqSQV7PddsSICVnUGj/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775759642; c=relaxed/simple; bh=rsFPmAnEQaN9n9f4V8aMdDmfyeQqxBv4dnKi76Z9Dbg=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=JU4/KWSho9eJrbvRV6/AfhhO1EiJ8DgGE84YWL3rMMLCUoLEEA1/l89fDBeqJ7Nuwge1/8lfsQEHfkkxRWWtGNke4+qGOLHZDKuELH+VeYAVphP7RQlb4bIS48eNgUyS6TSWdLslIHlMfuy9+VzqdK/59E7u+OjNUvXNeVt7hiU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VaaQ9xFi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VaaQ9xFi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDC76C4CEF7; Thu, 9 Apr 2026 18:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775759641; bh=rsFPmAnEQaN9n9f4V8aMdDmfyeQqxBv4dnKi76Z9Dbg=; h=Date:From:To:Cc:Subject:References:From; b=VaaQ9xFiltGXNvpj0/rFUE5nBMErJ6lfoojGtLdSeLPJLao35ROx7AcXV7pUuKJBZ j8mqPi53Y2Hq5sPqKJCZIXyOgjSErnjdgWrZkNLFnhnQA/Iowf3NLPjPKIvCHYUhhM Qn/jmfCRFSwtwh8wiJiFz02E4MFXZ0CFVwwy4oKGGcm0H+Ze01HSnVRsHXzgOz5yjs j8cb9J0gS+SoevDkIKSEc2l65Dgry5Qgqbl6Yu+5PsoLGEP/rAZZsnJ3SYJqVGa+8g ZHE8K/AQVHYUg7ggzPz2E4b9WeIVIvpxq8BGzpUGfYeWBmFyZI5aTbeY+6M3GViPPP K/77n++fEz2ug== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1wAuDp-00000003pGF-0kzF; Thu, 09 Apr 2026 14:35:21 -0400 Message-ID: <20260409183521.038020583@kernel.org> User-Agent: quilt/0.69 Date: Thu, 09 Apr 2026 14:34:58 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [for-next][PATCH 1/3] eventfs: Simplify code using guard()s References: <20260409183457.935983082@kernel.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 Use guard(mutex), scoped_guard(mutex) and guard(src) to simplify the code and remove a lot of the jumps to "out:" labels. Cc: Mathieu Desnoyers Link: https://lore.kernel.org/20250604151625.250d13e1@gandalf.local.home Signed-off-by: Steven Rostedt (Google) Reviewed-by: Masami Hiramatsu (Google) --- fs/tracefs/event_inode.c | 96 +++++++++++++++------------------------- 1 file changed, 36 insertions(+), 60 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 8e5ac464b328..af8d05df2726 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -180,29 +180,25 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, = struct dentry *dentry, const char *name; int ret; =20 - mutex_lock(&eventfs_mutex); + guard(mutex)(&eventfs_mutex); ei =3D dentry->d_fsdata; - if (ei->is_freed) { - /* Do not allow changes if the event is about to be removed. */ - mutex_unlock(&eventfs_mutex); + /* Do not allow changes if the event is about to be removed. */ + if (ei->is_freed) return -ENODEV; - } =20 /* Preallocate the children mode array if necessary */ if (!(dentry->d_inode->i_mode & S_IFDIR)) { if (!ei->entry_attrs) { ei->entry_attrs =3D kzalloc_objs(*ei->entry_attrs, ei->nr_entries, GFP_NOFS); - if (!ei->entry_attrs) { - ret =3D -ENOMEM; - goto out; - } + if (!ei->entry_attrs) + return -ENOMEM; } } =20 ret =3D simple_setattr(idmap, dentry, iattr); if (ret < 0) - goto out; + return ret; =20 /* * If this is a dir, then update the ei cache, only the file @@ -225,8 +221,6 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, st= ruct dentry *dentry, } } } - out: - mutex_unlock(&eventfs_mutex); return ret; } =20 @@ -528,26 +522,24 @@ static struct dentry *eventfs_root_lookup(struct inod= e *dir, struct tracefs_inode *ti; struct eventfs_inode *ei; const char *name =3D dentry->d_name.name; - struct dentry *result =3D NULL; =20 ti =3D get_tracefs(dir); if (WARN_ON_ONCE(!(ti->flags & TRACEFS_EVENT_INODE))) return ERR_PTR(-EIO); =20 - mutex_lock(&eventfs_mutex); + guard(mutex)(&eventfs_mutex); =20 ei =3D ti->private; if (!ei || ei->is_freed) - goto out; + return NULL; =20 list_for_each_entry(ei_child, &ei->children, list) { if (strcmp(ei_child->name, name) !=3D 0) continue; /* A child is freed and removed from the list at the same time */ if (WARN_ON_ONCE(ei_child->is_freed)) - goto out; - result =3D lookup_dir_entry(dentry, ei, ei_child); - goto out; + return NULL; + return lookup_dir_entry(dentry, ei, ei_child); } =20 for (int i =3D 0; i < ei->nr_entries; i++) { @@ -561,14 +553,12 @@ static struct dentry *eventfs_root_lookup(struct inod= e *dir, =20 data =3D ei->data; if (entry->callback(name, &mode, &data, &fops) <=3D 0) - goto out; + return NULL; + + return lookup_file_dentry(dentry, ei, i, mode, data, fops); =20 - result =3D lookup_file_dentry(dentry, ei, i, mode, data, fops); - goto out; } - out: - mutex_unlock(&eventfs_mutex); - return result; + return NULL; } =20 /* @@ -584,7 +574,6 @@ static int eventfs_iterate(struct file *file, struct di= r_context *ctx) struct eventfs_inode *ei; const char *name; umode_t mode; - int idx; int ret =3D -EINVAL; int ino; int i, r, c; @@ -598,16 +587,13 @@ static int eventfs_iterate(struct file *file, struct = dir_context *ctx) =20 c =3D ctx->pos - 2; =20 - idx =3D srcu_read_lock(&eventfs_srcu); + guard(srcu)(&eventfs_srcu); =20 - mutex_lock(&eventfs_mutex); - ei =3D READ_ONCE(ti->private); - if (ei && ei->is_freed) - ei =3D NULL; - mutex_unlock(&eventfs_mutex); - - if (!ei) - goto out; + scoped_guard(mutex, &eventfs_mutex) { + ei =3D READ_ONCE(ti->private); + if (!ei || ei->is_freed) + return -EINVAL; + } =20 /* * Need to create the dentries and inodes to have a consistent @@ -622,21 +608,19 @@ static int eventfs_iterate(struct file *file, struct = dir_context *ctx) entry =3D &ei->entries[i]; name =3D entry->name; =20 - mutex_lock(&eventfs_mutex); /* If ei->is_freed then just bail here, nothing more to do */ - if (ei->is_freed) { - mutex_unlock(&eventfs_mutex); - goto out; + scoped_guard(mutex, &eventfs_mutex) { + if (ei->is_freed) + return -EINVAL; + r =3D entry->callback(name, &mode, &cdata, &fops); } - r =3D entry->callback(name, &mode, &cdata, &fops); - mutex_unlock(&eventfs_mutex); if (r <=3D 0) continue; =20 ino =3D EVENTFS_FILE_INODE_INO; =20 if (!dir_emit(ctx, name, strlen(name), ino, DT_REG)) - goto out; + return -EINVAL; } =20 /* Subtract the skipped entries above */ @@ -659,19 +643,13 @@ static int eventfs_iterate(struct file *file, struct = dir_context *ctx) =20 ino =3D eventfs_dir_ino(ei_child); =20 - if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR)) - goto out_dec; + if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR)) { + /* Incremented ctx->pos without adding something, reset it */ + ctx->pos--; + return -EINVAL; + } } - ret =3D 1; - out: - srcu_read_unlock(&eventfs_srcu, idx); - - return ret; - - out_dec: - /* Incremented ctx->pos without adding something, reset it */ - ctx->pos--; - goto out; + return 1; } =20 /** @@ -728,11 +706,10 @@ struct eventfs_inode *eventfs_create_dir(const char *= name, struct eventfs_inode INIT_LIST_HEAD(&ei->children); INIT_LIST_HEAD(&ei->list); =20 - mutex_lock(&eventfs_mutex); - if (!parent->is_freed) - list_add_tail(&ei->list, &parent->children); - mutex_unlock(&eventfs_mutex); - + scoped_guard(mutex, &eventfs_mutex) { + if (!parent->is_freed) + list_add_tail(&ei->list, &parent->children); + } /* Was the parent freed? */ if (list_empty(&ei->list)) { cleanup_ei(ei); @@ -878,9 +855,8 @@ void eventfs_remove_dir(struct eventfs_inode *ei) if (!ei) return; =20 - mutex_lock(&eventfs_mutex); + guard(mutex)(&eventfs_mutex); eventfs_remove_rec(ei, 0); - mutex_unlock(&eventfs_mutex); } =20 /** --=20 2.51.0 From nobody Fri Jun 19 09:04:59 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 3F28F2F999F for ; Thu, 9 Apr 2026 18:34:02 +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=1775759642; cv=none; b=ancAKz07h4tKusA4Ed8Nr2FN7sJOJezkZYWoPD3nqR8/46havu+wGv9Dx+4FD1/5HhSryzxhpiJqyqKfINYG6GiH0YXzJn6mAiTM5eOL25m9w3CoCrCvXgfQisccegcB1+m+C9MvHxjF8c4LfBiYY7BhaYqJ+DRMrhe/HVGyOxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775759642; c=relaxed/simple; bh=zSj2vgNH5m1UoAUeVeVywV7f/QsqgNtXrWvn/JRmzdA=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Yf8ySKsdeiZgn2kSgOrcGEVF7VKXNI2FxNHyipFPQ8jJUKvKI/du6Xf9cagEtwi/nHWWwRlLzlZ3bTZVqHu8RTXrf9rATV4KuuFpFKf+0YKzOBms9K3gShukFs/5PGWi1Id3zQeEwZgMLEjU+s7n9Psx9MGxm76cWWqjZXplVW8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LjVn8PzQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LjVn8PzQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED193C2BCAF; Thu, 9 Apr 2026 18:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775759642; bh=zSj2vgNH5m1UoAUeVeVywV7f/QsqgNtXrWvn/JRmzdA=; h=Date:From:To:Cc:Subject:References:From; b=LjVn8PzQjQkJdvRX6FEqbnDH+A8dF3FGPw9jSx3vzgUDoor+JrxgeeFXEbR+ZuWBl hT6iqRA+pqRi6u87CqcpVewrAocErbJf8z+soqVL9S5lhfMEbpeziCYYlBwdmRJ/NB cIwbqmSQDo+3LBj3F0UdxBTKJ46tZHvwDquy73QMzLFrq1l3nL71jWwAU4rO4h4VgN KLW3S9+fJ8ATqg8252WPsM89eu6jRmnKS/UmXqJ4x7UA+ZeaMreFdiS4em77PKFaZG XMOQJVUOJVCKyY5blTELYYhjkaPm/ZqlivBC2As4m3hH1mVDQ3Npu2kNJ0grG5xYbr smfsHOIBHSFHw== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1wAuDp-00000003pGk-1R7J; Thu, 09 Apr 2026 14:35:21 -0400 Message-ID: <20260409183521.199439366@kernel.org> User-Agent: quilt/0.69 Date: Thu, 09 Apr 2026 14:34:59 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Al Viro , AnishMulay Subject: [for-next][PATCH 2/3] tracefs: Use dentry name snapshots instead of heap allocation References: <20260409183457.935983082@kernel.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: AnishMulay In fs/tracefs/inode.c, tracefs_syscall_mkdir() and tracefs_syscall_rmdir() previously used a local helper, get_dname(), which allocated a temporary buffer on the heap via kmalloc() to hold the dentry name. This introduced unnecessary overhead, an ENOMEM failure path, and required manual memory cleanup via kfree(). As suggested by Al Viro, replace this heap allocation with the VFS dentry name snapshot API. By stack-allocating a `struct name_snapshot` and using take_dentry_name_snapshot() and release_dentry_name_snapshot(), we safely capture the dentry name locklessly, eliminate the heap allocation entirely, and remove the now-obsolete error handling paths. The get_dname() helper is completely removed. Testing: Booted a custom kernel natively in virtme-ng (ARM64). Triggered tracefs inode and dentry allocation by creating and removing a custom directory under a temporary tracefs mount. Verified that the instance is created successfully and that no memory errors or warnings are emitted in dmesg. Link: https://patch.msgid.link/20260306200458.2264-1-anishm7030@gmail.com Suggested-by: Al Viro Signed-off-by: AnishMulay Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/inode.c | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index 51c00c8fa175..fa4c7e6aa5ff 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -94,33 +94,14 @@ static struct tracefs_dir_ops { int (*rmdir)(const char *name); } tracefs_ops __ro_after_init; =20 -static char *get_dname(struct dentry *dentry) -{ - const char *dname; - char *name; - int len =3D dentry->d_name.len; - - dname =3D dentry->d_name.name; - name =3D kmalloc(len + 1, GFP_KERNEL); - if (!name) - return NULL; - memcpy(name, dname, len); - name[len] =3D 0; - return name; -} - static struct dentry *tracefs_syscall_mkdir(struct mnt_idmap *idmap, struct inode *inode, struct dentry *dentry, umode_t mode) { struct tracefs_inode *ti; - char *name; + struct name_snapshot name; int ret; =20 - name =3D get_dname(dentry); - if (!name) - return ERR_PTR(-ENOMEM); - /* * This is a new directory that does not take the default of * the rootfs. It becomes the default permissions for all the @@ -135,24 +116,20 @@ static struct dentry *tracefs_syscall_mkdir(struct mn= t_idmap *idmap, * the files within the tracefs system. It is up to the individual * mkdir routine to handle races. */ + take_dentry_name_snapshot(&name, dentry); inode_unlock(inode); - ret =3D tracefs_ops.mkdir(name); + ret =3D tracefs_ops.mkdir(name.name.name); inode_lock(inode); - - kfree(name); + release_dentry_name_snapshot(&name); =20 return ERR_PTR(ret); } =20 static int tracefs_syscall_rmdir(struct inode *inode, struct dentry *dentr= y) { - char *name; + struct name_snapshot name; int ret; =20 - name =3D get_dname(dentry); - if (!name) - return -ENOMEM; - /* * The rmdir call can call the generic functions that create * the files within the tracefs system. It is up to the individual @@ -160,15 +137,15 @@ static int tracefs_syscall_rmdir(struct inode *inode,= struct dentry *dentry) * This time we need to unlock not only the parent (inode) but * also the directory that is being deleted. */ + take_dentry_name_snapshot(&name, dentry); inode_unlock(inode); inode_unlock(d_inode(dentry)); =20 - ret =3D tracefs_ops.rmdir(name); + ret =3D tracefs_ops.rmdir(name.name.name); =20 inode_lock_nested(inode, I_MUTEX_PARENT); inode_lock(d_inode(dentry)); - - kfree(name); + release_dentry_name_snapshot(&name); =20 return ret; } --=20 2.51.0 From nobody Fri Jun 19 09:04:59 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 7054C30C37C; Thu, 9 Apr 2026 18:34:02 +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=1775759642; cv=none; b=TXao/6n6dKIqPj4WGJKuw+CkXsshtE3I2go0LMEQDCNQBRLRQS4PnGPbRfa9sb5wI3DRLLraBHwLA9hqo9RrtUaBHaLsFVYITNfR1+CfJcndZUe4livm7tvO8q2WoWUVYJtH/fPbEIhYhBYHS15uVer1g30JlduOTpT4Gk2AP+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775759642; c=relaxed/simple; bh=2x4T0Y1JzS1vzWskwMOMLHIuUdYKOC0Iw72au6ZCYps=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=BOAxWNqun5gMn1auryW79/ABHUeUqQRR1CKcF2R2KKlEOSIMyKuA8PKb+1uUjzKHFucQSEaKjePU4EDHMARsIN2sr/TAd+/HsakBaUzvJKeXqeSpu5TioDwwZp0qd26F9HDNGUtPBwf0QpO7CyZBFWeODZgGGJCUw16xODdjVwg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tVhgjCly; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tVhgjCly" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52E91C4AF09; Thu, 9 Apr 2026 18:34:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775759642; bh=2x4T0Y1JzS1vzWskwMOMLHIuUdYKOC0Iw72au6ZCYps=; h=Date:From:To:Cc:Subject:References:From; b=tVhgjClyQ8rPbGQlYOp89rGlRuSe61MPprFnEZGzvj304nCJ4CmghYU0VkfQhzP8X 20JD3oTGUut+x7/WUJcx8b18mngxo+Jdllts4L42dWyxdOj9EQRzVw6tcDCQ9ED/5s ls1V6FMX3x5oAhvUmjFE1JqlpCmXXYYXS3hKvoahfnqI6EUEg8L1NLNb1wa9B9Bczr A4FKsNtiNuWwI1VANlH1gl43P7x9EjMIOP6rOfmr+YqcrNaIqZY4w31FA762FH6kc7 SlMwRACfzdW/EEjQYS65OQF8dY+WBYj6r6SWLcdOh5KqYKmfv15M5KXwRfh3jSujj6 MFydXXVxvINqg== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1wAuDp-00000003pHF-27y7; Thu, 09 Apr 2026 14:35:21 -0400 Message-ID: <20260409183521.365349196@kernel.org> User-Agent: quilt/0.69 Date: Thu, 09 Apr 2026 14:35:00 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , stable@vger.kernel.org, David Carlier Subject: [for-next][PATCH 3/3] tracefs: Fix default permissions not being applied on initial mount References: <20260409183457.935983082@kernel.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: David Carlier Commit e4d32142d1de ("tracing: Fix tracefs mount options") moved the option application from tracefs_fill_super() to tracefs_reconfigure() called from tracefs_get_tree(). This fixed mount options being ignored on user-space mounts when the superblock already exists, but introduced a regression for the initial kernel-internal mount. On the first mount (via simple_pin_fs during init), sget_fc() transfers fc->s_fs_info to sb->s_fs_info and sets fc->s_fs_info to NULL. When tracefs_get_tree() then calls tracefs_reconfigure(), it sees a NULL fc->s_fs_info and returns early without applying any options. The root inode keeps mode 0755 from simple_fill_super() instead of the intended TRACEFS_DEFAULT_MODE (0700). Furthermore, even on subsequent user-space mounts without an explicit mode=3D option, tracefs_apply_options(sb, true) gates the mode behind fsi->opts & BIT(Opt_mode), which is unset for the defaults. So the mode is never corrected unless the user explicitly passes mode=3D0700. Restore the tracefs_apply_options(sb, false) call in tracefs_fill_super() to apply default permissions on initial superblock creation, matching what debugfs does in debugfs_fill_super(). Cc: stable@vger.kernel.org Fixes: e4d32142d1de ("tracing: Fix tracefs mount options") Link: https://patch.msgid.link/20260404134747.98867-1-devnexen@gmail.com Signed-off-by: David Carlier Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index fa4c7e6aa5ff..5602baf980f6 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -468,6 +468,7 @@ static int tracefs_fill_super(struct super_block *sb, s= truct fs_context *fc) return err; =20 sb->s_op =3D &tracefs_super_operations; + tracefs_apply_options(sb, false); set_default_d_op(sb, &tracefs_dentry_operations); =20 return 0; --=20 2.51.0