[dm-devel] [PATCH 2/8] block: remove the extra kobject reference in bd_link_disk_holder
Mike Snitzer
snitzer at redhat.com
Thu Jul 29 16:27:11 UTC 2021
On Sun, Jul 25 2021 at 1:54P -0400,
Christoph Hellwig <hch at lst.de> wrote:
> With the new block_device life time rules there is no way for the
> bdev to go away as long as there is a holder, so remove these.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
Might be useful to reference the primary commit that introduced "the
new block_device life time rules" just so readers can inform
themselves.
Reviewed-by: Mike Snitzer <snitzer at redhat.com>
> ---
> block/holder.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/block/holder.c b/block/holder.c
> index 904a1dcd5c12..960654a71342 100644
> --- a/block/holder.c
> +++ b/block/holder.c
> @@ -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;
> @@ -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);
> }
> --
> 2.30.2
>
More information about the dm-devel
mailing list