diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2025-03-22 21:06:11 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2025-07-02 22:44:38 -0400 |
| commit | 59200f45267481582f4e42334a510f01d0b89449 (patch) | |
| tree | 36221b5bbec83215c21d33fd474efe42c38e89e5 /fs/tracefs | |
| parent | 2a8061ee5e41034eb14170ec4517b5583dbeff9f (diff) | |
new helper: simple_start_creating()
Set the things up for kernel-initiated creation of object in
a tree-in-dcache filesystem. With respect to locking it's
an equivalent of filename_create() - we either get a negative
dentry with locked parent, or ERR_PTR() and no locks taken.
tracefs and debugfs had that open-coded as part of their
object creation machinery; switched to calling new helper.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/tracefs')
| -rw-r--r-- | fs/tracefs/inode.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index a3fd3cc591bd..4e5d091e9263 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -551,20 +551,9 @@ struct dentry *tracefs_start_creating(const char *name, struct dentry *parent) if (!parent) parent = tracefs_mount->mnt_root; - inode_lock(d_inode(parent)); - if (unlikely(IS_DEADDIR(d_inode(parent)))) - dentry = ERR_PTR(-ENOENT); - else - dentry = lookup_noperm(&QSTR(name), parent); - if (!IS_ERR(dentry) && d_inode(dentry)) { - dput(dentry); - dentry = ERR_PTR(-EEXIST); - } - - if (IS_ERR(dentry)) { - inode_unlock(d_inode(parent)); + dentry = simple_start_creating(parent, name); + if (IS_ERR(dentry)) simple_release_fs(&tracefs_mount, &tracefs_mount_count); - } return dentry; } |
