diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2026-05-12 09:10:35 +0300 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2026-06-08 21:53:09 +0300 |
| commit | 17bee4d214a4dd6f062edf5eb71fbe681304bc32 (patch) | |
| tree | 5c46cb454c1906ef89d72c060b5eda38f55f7dde | |
| parent | acef053618d190c3ac418eda3f678d1043e9362c (diff) | |
| download | linux-17bee4d214a4dd6f062edf5eb71fbe681304bc32.tar.xz | |
populate_group(): move cleanup on failure to the sole caller
... where it folds with configfs_detach_item() into a call of
configfs_detach_group().
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | fs/configfs/dir.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index c420191610c3..01de8ef5fbe6 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -754,17 +754,13 @@ static int populate_groups(struct config_group *group, struct configfs_fragment *frag) { struct config_group *new_group; - int ret = 0; list_for_each_entry(new_group, &group->default_groups, group_entry) { - ret = create_default_group(group, new_group, frag); - if (ret) { - detach_groups(group); - break; - } + int ret = create_default_group(group, new_group, frag); + if (ret) + return ret; } - - return ret; + return 0; } void configfs_remove_default_groups(struct config_group *group) @@ -904,6 +900,13 @@ static void configfs_detach_item(struct config_item *item) configfs_remove_dir(item); } +/* Caller holds the mutex of the group's inode */ +static void configfs_detach_group(struct config_item *item) +{ + detach_groups(to_config_group(item)); + configfs_detach_item(item); +} + static int configfs_attach_group(struct config_item *parent_item, struct config_item *item, struct dentry *dentry, @@ -930,7 +933,7 @@ static int configfs_attach_group(struct config_item *parent_item, configfs_adjust_dir_dirent_depth_before_populate(sd); ret = populate_groups(to_config_group(item), frag); if (ret) { - configfs_detach_item(item); + configfs_detach_group(item); d_inode(dentry)->i_flags |= S_DEAD; dont_mount(dentry); } @@ -943,13 +946,6 @@ static int configfs_attach_group(struct config_item *parent_item, return ret; } -/* Caller holds the mutex of the group's inode */ -static void configfs_detach_group(struct config_item *item) -{ - detach_groups(to_config_group(item)); - configfs_detach_item(item); -} - /* * After the item has been detached from the filesystem view, we are * ready to tear it out of the hierarchy. Notify the client before |
