From: Al Viro Date: Tue, 12 May 2026 16:18:21 +0000 (-0400) Subject: configfs: mark pinned dentries persistent X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=1387aedb391ac6e790fa941f29570d6f72113dd9;p=thirdparty%2Fkernel%2Flinux.git configfs: mark pinned dentries persistent on the removal side we can (finally) get rid of __simple_unlink() and __simple_rmdir() kludges now that dentries in question are properly marked persistent - simple_unlink() and simple_rmdir() will do the right thing for those. Reviewed-by: Jan Kara Signed-off-by: Al Viro --- diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 4836ffb3b70f..479d37b8d806 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -315,9 +315,7 @@ static int configfs_create_dir(struct config_item *item, struct dentry *dentry, inode->i_fop = &configfs_dir_operations; /* directory inodes start off with i_nlink == 2 (for "." entry) */ inc_nlink(inode); - d_instantiate(dentry, inode); - /* already hashed */ - dget(dentry); /* pin directory dentries in core */ + d_make_persistent(dentry, inode); inc_nlink(d_inode(p)); item->ci_dentry = dentry; return 0; @@ -385,8 +383,7 @@ int configfs_create_link(struct configfs_dirent *target, struct dentry *parent, inode->i_link = body; inode->i_op = &configfs_symlink_inode_operations; - d_instantiate(dentry, inode); - dget(dentry); /* pin link dentries in core */ + d_make_persistent(dentry, inode); return 0; out_remove: @@ -413,12 +410,8 @@ static void configfs_remove_dir(struct dentry *d) configfs_remove_dirent(d); if (d_really_is_positive(d)) { - if (likely(simple_empty(d))) { - __simple_rmdir(d_inode(parent),d); - dput(d); - } else { + if (unlikely(simple_rmdir(d_inode(parent), d))) pr_warn("remove_dir (%pd): attributes remain", d); - } } pr_debug(" o %pd removing done (%d)\n", d, d_count(d)); diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c index f3f79c67add5..31eb28b27309 100644 --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c @@ -229,9 +229,8 @@ int configfs_unlink(struct inode *dir, struct dentry *dentry) spin_lock(&configfs_dirent_lock); list_del_init(&sd->s_sibling); spin_unlock(&configfs_dirent_lock); - configfs_drop_dentry(sd, dentry->d_parent); - dput(dentry); configfs_put(sd); + simple_unlink(dir, dentry); /* * drop_link() must be called before