]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
configfs_depend_prep(): pass configfs_dirent instead of dentry
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 12 May 2026 05:23:29 +0000 (01:23 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 8 Jun 2026 18:53:09 +0000 (14:53 -0400)
Again, the only thing it uses dentry for is dentry->d_fsdata; for the
recursive call the situation is the same as with configfs_detach_prep()
and the same observation about ->s_dentry->d_fsdata applies.

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 b456e4de25ab620d708995a7fd8d1296dffab180..a6b99bcbddbc13929af9dbaa8724e731b911eeac 100644 (file)
@@ -1093,15 +1093,12 @@ static int configfs_dump(struct configfs_dirent *sd, int level)
  * much on the stack, though, so folks that need this function - be careful
  * about your stack!  Patches will be accepted to make it iterative.
  */
-static int configfs_depend_prep(struct dentry *origin,
+static int configfs_depend_prep(struct configfs_dirent *sd,
                                struct config_item *target)
 {
-       struct configfs_dirent *child_sd, *sd;
+       struct configfs_dirent *child_sd;
        int ret = 0;
 
-       BUG_ON(!origin || !origin->d_fsdata);
-       sd = origin->d_fsdata;
-
        if (sd->s_element == target)  /* Boo-yah */
                goto out;
 
@@ -1109,8 +1106,7 @@ static int configfs_depend_prep(struct dentry *origin,
                if ((child_sd->s_type & CONFIGFS_DIR) &&
                    !(child_sd->s_type & CONFIGFS_USET_DROPPING) &&
                    !(child_sd->s_type & CONFIGFS_USET_CREATING)) {
-                       ret = configfs_depend_prep(child_sd->s_dentry,
-                                                  target);
+                       ret = configfs_depend_prep(child_sd, target);
                        if (!ret)
                                goto out;  /* Child path boo-yah */
                }
@@ -1131,7 +1127,7 @@ static int configfs_do_depend_item(struct dentry *subsys_dentry,
 
        spin_lock(&configfs_dirent_lock);
        /* Scan the tree, return 0 if found */
-       ret = configfs_depend_prep(subsys_dentry, target);
+       ret = configfs_depend_prep(subsys_dentry->d_fsdata, target);
        if (ret)
                goto out_unlock_dirent_lock;