Skip to content

Commit

Permalink
block: remove the extra kobject reference in bd_link_disk_holder
Browse files Browse the repository at this point in the history
Since commit 0d02129 ("block: merge struct block_device and struct
hd_struct") there is no way for the bdev to go away as long as there is
a holder, so remove the extra references.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Mike Snitzer <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Aug 9, 2021
1 parent c66fd01 commit fbd9a39
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions block/holder.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk)
ret = add_symlink(bdev->bd_holder_dir, &disk_to_dev(disk)->kobj);
if (ret)
goto out_del;
/*
* bdev could be deleted beneath us which would implicitly destroy
* the holder directory. Hold on to it.
*/
kobject_get(bdev->bd_holder_dir);

list_add(&holder->list, &bdev->bd_holder_disks);
goto out_unlock;
Expand Down Expand Up @@ -130,7 +125,6 @@ void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk)
if (!WARN_ON_ONCE(holder == NULL) && !--holder->refcnt) {
del_symlink(disk->slave_dir, bdev_kobj(bdev));
del_symlink(bdev->bd_holder_dir, &disk_to_dev(disk)->kobj);
kobject_put(bdev->bd_holder_dir);
list_del_init(&holder->list);
kfree(holder);
}
Expand Down

0 comments on commit fbd9a39

Please sign in to comment.