Btrfs: Check if kobject is initialized before put

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
Anand Jain 2015-06-22 18:18:32 +08:00 committed by David Sterba
parent 24199d206a
commit f90fc54728
1 changed files with 5 additions and 3 deletions

View File

@ -523,9 +523,11 @@ static void __btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs)
fs_devs->device_dir_kobj = NULL;
}
kobject_del(&fs_devs->super_kobj);
kobject_put(&fs_devs->super_kobj);
wait_for_completion(&fs_devs->kobj_unregister);
if (fs_devs->super_kobj.state_initialized) {
kobject_del(&fs_devs->super_kobj);
kobject_put(&fs_devs->super_kobj);
wait_for_completion(&fs_devs->kobj_unregister);
}
}
/* when fs_devs is NULL it will remove all fsid kobject */