Skip to content

Commit

Permalink
Btrfs: Check if kobject is initialized before put
Browse files Browse the repository at this point in the history
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Tested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: David Sterba <dsterba@suse.cz>
  • Loading branch information
Anand Jain authored and David Sterba committed Jun 22, 2015
1 parent 24199d2 commit f90fc54
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fs/btrfs/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit f90fc54

Please sign in to comment.