Re: [PATCH] block: release disk reference in hd_struct_free_work

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

 



On Tue, Sep 01, 2020 at 05:00:33PM +0800, Ming Lei wrote:
>  	struct hd_struct *part =
>  		container_of(to_rcu_work(work), struct hd_struct, rcu_work);
> +	struct gendisk *disk = part_to_disk(part);
> +
> +	/*
> +	 * Release disk reference grabbed in delete_partition, and it should
> +	 * have been done in hd_struct_free(), however device's release
> +	 * handler can't be run in percpu_ref's ->release() callback because
> +	 * it is run via call_rcu().
> +	 */
> +	put_device(disk_to_dev(disk));

The fix looks good, but the comment reads a little strange.  What about:

	/*
	 * Release the disk reference acquired in delete_partition here.
	 * We can't release it in hd_struct_free because the final put_device
	 * needs process context and thus can't be run directly from a
	 * percpu_ref ->release handler.
	 */



[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