]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
configfs_detach_prep(): pass configfs_dirent instead of dentry
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 12 May 2026 05:17:13 +0000 (01:17 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 8 Jun 2026 18:53:09 +0000 (14:53 -0400)
The only thing it uses the argument for is its ->d_fsdata and
all callers have that already available.

Note that in the recursive call we are dealing with a (sub)directory
configfs_dirent, and for those ->s_dentry->d_fsdata points back
to configfs_dirent itself.

Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/configfs/dir.c

index 8181771c8a58f3b78fb6e6ad947f9dd73c41e51d..b456e4de25ab620d708995a7fd8d1296dffab180 100644 (file)
@@ -517,9 +517,8 @@ done:
  * If there is an error, the caller will reset the flags via
  * configfs_detach_rollback().
  */
-static int configfs_detach_prep(struct dentry *dentry, struct dentry **wait)
+static int configfs_detach_prep(struct configfs_dirent *parent_sd, struct dentry **wait)
 {
-       struct configfs_dirent *parent_sd = dentry->d_fsdata;
        struct configfs_dirent *sd;
        int ret;
 
@@ -547,7 +546,7 @@ static int configfs_detach_prep(struct dentry *dentry, struct dentry **wait)
                         * Yup, recursive.  If there's a problem, blame
                         * deep nesting of default_groups
                         */
-                       ret = configfs_detach_prep(sd->s_dentry, wait);
+                       ret = configfs_detach_prep(sd, wait);
                        if (!ret)
                                continue;
                } else
@@ -1540,7 +1539,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
                 */
                ret = sd->s_dependent_count ? -EBUSY : 0;
                if (!ret) {
-                       ret = configfs_detach_prep(dentry, &wait);
+                       ret = configfs_detach_prep(sd, &wait);
                        if (ret)
                                configfs_detach_rollback(dentry);
                }
@@ -1837,7 +1836,7 @@ void configfs_unregister_group(struct config_group *group)
 
        inode_lock_nested(d_inode(parent), I_MUTEX_PARENT);
        spin_lock(&configfs_dirent_lock);
-       configfs_detach_prep(dentry, NULL);
+       configfs_detach_prep(sd, NULL);
        spin_unlock(&configfs_dirent_lock);
 
        configfs_detach_group(&group->cg_item);
@@ -1984,7 +1983,7 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
        inode_lock_nested(d_inode(dentry), I_MUTEX_CHILD);
        mutex_lock(&configfs_symlink_mutex);
        spin_lock(&configfs_dirent_lock);
-       if (configfs_detach_prep(dentry, NULL)) {
+       if (configfs_detach_prep(sd, NULL)) {
                pr_err("Tried to unregister non-empty subsystem!\n");
        }
        spin_unlock(&configfs_dirent_lock);