Re: holders not working properly, regression [was: Re: use regular gendisk registration in device mapper v2]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 19 2021 at  2:05P -0400,
Christoph Hellwig <hch@xxxxxx> wrote:

> Manually reverting "block: remove the extra kobject reference in
> bd_link_disk_holder" as show below fixed the issue for me.  I'll spend
> some more time tomorrow trying to fully understan the life time rules
> tomorrow before sending a patch, though.
> 
> ---
> From 6b94f5435900d23769db8d07ff47415aab4ac63e Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@xxxxxx>
> Date: Thu, 19 Aug 2021 20:01:43 +0200
> Subject: Revert "block: remove the extra kobject reference in
>  bd_link_disk_holder"
> 
> This reverts commit fbd9a39542ecdd2ade55869c13856b2590db3df8.
> ---
>  block/holder.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/block/holder.c b/block/holder.c
> index 4568cc4f6827..ecbc6941e7d8 100644
> --- a/block/holder.c
> +++ b/block/holder.c
> @@ -106,6 +106,12 @@ int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk)
>  	}
>  
>  	list_add(&holder->list, &disk->slave_bdevs);
> +	/*
> +	 * bdev could be deleted beneath us which would implicitly destroy
> +	 * the holder directory.  Hold on to it.
> +	 */
> +	kobject_get(bdev->bd_holder_dir);
> +
>  out_unlock:
>  	mutex_unlock(&disk->open_mutex);
>  	return ret;
> @@ -138,6 +144,7 @@ void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk)
>  	if (!WARN_ON_ONCE(holder == NULL) && !--holder->refcnt) {
>  		if (disk->slave_dir)
>  			__unlink_disk_holder(bdev, disk);
> +		kobject_put(bdev->bd_holder_dir);
>  		list_del_init(&holder->list);
>  		kfree(holder);
>  	}
> -- 
> 2.30.2
> 

OK, this fixed it for me too, thanks.

Mike




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux