Re: [PATCH 3/3] block: warn if ->groups is set when calling add_disk

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

 



On Mon, Sep 20, 2021 at 09:27:26AM +0200, Christoph Hellwig wrote:
> The proper API is to pass the groups to device_add_disk, but the code
> used to also allow groups being set before calling *add_disk.  Warn
> about that but keep the group pointer intact for now so that it can
> be removed again after a grace period.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> Fixes: 52b85909f85d ("block: fold register_disk into device_add_disk")

Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx>

> ---
>  block/genhd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 7b6e5e1cf9564..409cf608cc5bd 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -439,7 +439,8 @@ int device_add_disk(struct device *parent, struct gendisk *disk,
>  	dev_set_uevent_suppress(ddev, 1);
>  
>  	ddev->parent = parent;
> -	ddev->groups = groups;
> +	if (!WARN_ON_ONCE(ddev->groups))
> +		ddev->groups = groups;
>  	dev_set_name(ddev, "%s", disk->disk_name);
>  	if (!(disk->flags & GENHD_FL_HIDDEN))
>  		ddev->devt = MKDEV(disk->major, disk->first_minor);
> -- 
> 2.30.2
> 



[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