From: Al Viro <viro@zeniv.linux.org.uk>
To: linux-fsdevel@vger.kernel.org
Cc: torvalds@linux-foundation.org, brauner@kernel.org, jack@suse.cz,
raven@themaw.net, miklos@szeredi.hu, a.hindborg@kernel.org,
linux-mm@kvack.org, linux-efi@vger.kernel.org,
ocfs2-devel@lists.linux.dev, kees@kernel.org,
rostedt@goodmis.org, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, paul@paul-moore.com,
casey@schaufler-ca.com, linuxppc-dev@lists.ozlabs.org,
borntraeger@linux.ibm.com
Subject: [PATCH 17/39] convert tracefs
Date: Sat, 20 Sep 2025 08:47:36 +0100 [thread overview]
Message-ID: <20250920074759.3564072-17-viro@zeniv.linux.org.uk> (raw)
In-Reply-To: <20250920074759.3564072-1-viro@zeniv.linux.org.uk>
A mix of persistent and non-persistent dentries in there. Strictly
speaking, no need for kill_litter_super() anyway - it pins an internal
mount whenever a persistent dentry is created, so at fs shutdown time
there won't be any to deal with.
However, let's make it explicit - replace d_instantiate() with
d_make_persistent() + dput() (the latter in tracefs_end_creating())
for dentries we want persistent and have d_make_discardable() done
either by simple_recursive_removal() (used by tracefs_remove())
or explicitly in eventfs_remove_events_dir().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/tracefs/event_inode.c | 4 ++--
fs/tracefs/inode.c | 13 ++++++-------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 8705c77a9e75..97bb0a79b0cd 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -822,7 +822,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
* something not worth much. Keeping directory links at 1
* tells userspace not to trust the link number.
*/
- d_instantiate(dentry, inode);
+ d_make_persistent(dentry, inode);
/* The dentry of the "events" parent does keep track though */
inc_nlink(dentry->d_parent->d_inode);
fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
@@ -909,5 +909,5 @@ void eventfs_remove_events_dir(struct eventfs_inode *ei)
* and destroyed dynamically.
*/
d_invalidate(dentry);
- dput(dentry);
+ d_make_discardable(dentry);
}
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 0c023941a316..d9d8932a7b9c 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -538,7 +538,7 @@ static struct file_system_type trace_fs_type = {
.name = "tracefs",
.init_fs_context = tracefs_init_fs_context,
.parameters = tracefs_param_specs,
- .kill_sb = kill_litter_super,
+ .kill_sb = kill_anon_super,
};
MODULE_ALIAS_FS("tracefs");
@@ -571,16 +571,15 @@ struct dentry *tracefs_start_creating(const char *name, struct dentry *parent)
struct dentry *tracefs_failed_creating(struct dentry *dentry)
{
- inode_unlock(d_inode(dentry->d_parent));
- dput(dentry);
+ simple_done_creating(dentry);
simple_release_fs(&tracefs_mount, &tracefs_mount_count);
return NULL;
}
struct dentry *tracefs_end_creating(struct dentry *dentry)
{
- inode_unlock(d_inode(dentry->d_parent));
- return dentry;
+ simple_done_creating(dentry);
+ return dentry; // borrowed
}
/* Find the inode that this will use for default */
@@ -661,7 +660,7 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode,
inode->i_private = data;
inode->i_uid = d_inode(dentry->d_parent)->i_uid;
inode->i_gid = d_inode(dentry->d_parent)->i_gid;
- d_instantiate(dentry, inode);
+ d_make_persistent(dentry, inode);
fsnotify_create(d_inode(dentry->d_parent), dentry);
return tracefs_end_creating(dentry);
}
@@ -692,7 +691,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,
/* directory inodes start off with i_nlink == 2 (for "." entry) */
inc_nlink(inode);
- d_instantiate(dentry, inode);
+ d_make_persistent(dentry, inode);
inc_nlink(d_inode(dentry->d_parent));
fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
return tracefs_end_creating(dentry);
--
2.47.3
next prev parent reply other threads:[~2025-09-20 7:48 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-20 7:41 [PATCHES][RFC] the meat of tree-in-dcache series Al Viro
2025-09-20 7:47 ` [PATCH 01/39] new helper: simple_remove_by_name() Al Viro
2025-09-20 7:47 ` [PATCH 02/39] new helper: simple_done_creating() Al Viro
2025-09-20 7:47 ` [PATCH 03/39] introduce a flag for explicitly marking persistently pinned dentries Al Viro
2025-09-20 7:47 ` [PATCH 04/39] primitives for maintaining persisitency Al Viro
2025-09-20 7:47 ` [PATCH 05/39] convert simple_{link,unlink,rmdir,rename,fill_super}() to new primitives Al Viro
2025-09-20 7:47 ` [PATCH 06/39] convert ramfs and tmpfs Al Viro
2025-09-20 7:47 ` [PATCH 07/39] procfs: make /self and /thread_self dentries persistent Al Viro
2025-09-20 7:47 ` [PATCH 08/39] configfs, securityfs: kill_litter_super() not needed Al Viro
2025-09-24 16:56 ` Joel Becker
2025-09-20 7:47 ` [PATCH 09/39] convert xenfs Al Viro
2025-09-20 7:47 ` [PATCH 10/39] convert smackfs Al Viro
2025-09-22 15:11 ` Casey Schaufler
2025-09-20 7:47 ` [PATCH 11/39] convert hugetlbfs Al Viro
2025-09-20 7:47 ` [PATCH 12/39] convert mqueue Al Viro
2025-09-20 7:47 ` [PATCH 13/39] convert bpf Al Viro
2025-09-20 7:47 ` [PATCH 14/39] convert dlmfs Al Viro
2025-09-20 7:47 ` [PATCH 15/39] convert fuse_ctl Al Viro
2025-09-20 7:47 ` [PATCH 16/39] convert pstore Al Viro
2025-09-20 7:47 ` Al Viro [this message]
2025-09-20 7:47 ` [PATCH 18/39] convert debugfs Al Viro
2025-09-23 8:10 ` Greg KH
2025-09-20 7:47 ` [PATCH 19/39] debugfs: remove duplicate checks in callers of start_creating() Al Viro
2025-09-23 8:10 ` Greg KH
2025-09-20 7:47 ` [PATCH 20/39] convert efivarfs Al Viro
2025-09-20 7:47 ` [PATCH 21/39] convert spufs Al Viro
2025-09-20 7:47 ` [PATCH 22/39] convert ibmasmfs Al Viro
2025-09-20 7:47 ` [PATCH 23/39] ibmasmfs: get rid of ibmasmfs_dir_ops Al Viro
2025-09-20 7:47 ` [PATCH 24/39] convert devpts Al Viro
2025-09-20 7:47 ` [PATCH 25/39] binderfs: use simple_start_creating() Al Viro
2025-09-20 7:47 ` [PATCH 26/39] binderfs_binder_ctl_create(): kill a bogus check Al Viro
2025-09-20 7:47 ` [PATCH 27/39] convert binderfs Al Viro
2025-09-20 7:47 ` [PATCH 28/39] autofs_{rmdir,unlink}: dentry->d_fsdata->dentry == dentry there Al Viro
2025-09-20 7:47 ` [PATCH 29/39] convert autofs Al Viro
2025-09-20 7:47 ` [PATCH 30/39] convert binfmt_misc Al Viro
2025-09-20 7:47 ` [PATCH 31/39] convert selinuxfs Al Viro
2025-09-21 20:44 ` Paul Moore
2025-09-21 22:26 ` Al Viro
2025-09-22 2:50 ` Paul Moore
2025-09-22 3:52 ` Al Viro
2025-09-20 7:47 ` [PATCH 32/39] functionfs: switch to simple_remove_by_name() Al Viro
2025-09-20 7:47 ` [PATCH 33/39] convert functionfs Al Viro
2025-09-20 7:47 ` [PATCH 34/39] gadgetfs: switch to simple_remove_by_name() Al Viro
2025-09-20 7:47 ` [PATCH 35/39] convert gadgetfs Al Viro
2025-09-20 7:47 ` [PATCH 36/39] hypfs: don't pin dentries twice Al Viro
2025-09-20 7:47 ` [PATCH 37/39] hypfs: switch hypfs_create_str() to returning int Al Viro
2025-09-20 7:47 ` [PATCH 38/39] hypfs: swich hypfs_create_u64() " Al Viro
2025-09-20 7:47 ` [PATCH 39/39] convert hypfs Al Viro
2025-09-20 16:26 ` [PATCHES][RFC] the meat of tree-in-dcache series Linus Torvalds
2025-09-20 18:09 ` Al Viro
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=20250920074759.3564072-17-viro@zeniv.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=a.hindborg@kernel.org \
--cc=borntraeger@linux.ibm.com \
--cc=brauner@kernel.org \
--cc=casey@schaufler-ca.com \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=kees@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-usb@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=miklos@szeredi.hu \
--cc=ocfs2-devel@lists.linux.dev \
--cc=paul@paul-moore.com \
--cc=raven@themaw.net \
--cc=rostedt@goodmis.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