static void __btrfs_sysfs_remove_one(struct btrfs_fs_info *fs_info)
{
+ if (fs_info->device_dir_kobj) {
+ btrfs_kobj_rm_device(fs_info, NULL);
+ kobject_del(fs_info->device_dir_kobj);
+ kobject_put(fs_info->device_dir_kobj);
+ fs_info->device_dir_kobj = NULL;
+ }
+
kobject_del(&fs_info->super_kobj);
kobject_put(&fs_info->super_kobj);
wait_for_completion(&fs_info->kobj_unregister);
kobject_del(fs_info->space_info_kobj);
kobject_put(fs_info->space_info_kobj);
}
- if (fs_info->device_dir_kobj) {
- btrfs_kobj_rm_device(fs_info, NULL);
- kobject_del(fs_info->device_dir_kobj);
- kobject_put(fs_info->device_dir_kobj);
- fs_info->device_dir_kobj = NULL;
- }
addrm_unknown_feature_attrs(fs_info, false);
sysfs_remove_group(&fs_info->super_kobj, &btrfs_feature_attr_group);
__btrfs_sysfs_remove_one(fs_info);
if (error)
return error;
+ error = btrfs_kobj_add_device(fs_info, NULL);
+ if (error) {
+ __btrfs_sysfs_remove_one(fs_info);
+ return error;
+ }
+
error = sysfs_create_group(&fs_info->super_kobj,
&btrfs_feature_attr_group);
if (error) {
if (error)
goto failure;
- error = btrfs_kobj_add_device(fs_info, NULL);
- if (error)
- goto failure;
-
fs_info->space_info_kobj = kobject_create_and_add("allocation",
&fs_info->super_kobj);
if (!fs_info->space_info_kobj) {