[PATCH 02/39] new helper: simple_done_creating()
Al Viro
viro at zeniv.linux.org.uk
Sat Sep 20 17:47:21 AEST 2025
should be paired with simple_start_creating() - unlocks parent and
drops dentry reference.
Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>
---
fs/libfs.c | 8 ++++++++
include/linux/fs.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/fs/libfs.c b/fs/libfs.c
index d029aff41f66..a033f35493d0 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -2326,3 +2326,11 @@ struct dentry *simple_start_creating(struct dentry *parent, const char *name)
return dentry;
}
EXPORT_SYMBOL(simple_start_creating);
+
+/* parent must have been held exclusive since simple_start_creating() */
+void simple_done_creating(struct dentry *child)
+{
+ inode_unlock(child->d_parent->d_inode);
+ dput(child);
+}
+EXPORT_SYMBOL(simple_done_creating);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3a33c68249e2..e3000302c3b9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3659,6 +3659,7 @@ extern int simple_fill_super(struct super_block *, unsigned long,
extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
extern void simple_release_fs(struct vfsmount **mount, int *count);
struct dentry *simple_start_creating(struct dentry *, const char *);
+void simple_done_creating(struct dentry *);
extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
loff_t *ppos, const void *from, size_t available);
--
2.47.3
More information about the Linuxppc-dev
mailing list