Re: [PATCH 2/5] nvme: register ns_id attributes as default sysfs groups

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

 



On Wed, Sep 05, 2018 at 09:00:50AM +0200, Hannes Reinecke wrote:
> We should be registering the ns_id attribute as default sysfs
> attribute groups, otherwise we have a race condition between
> the uevent and the attributes appearing in sysfs.

Please give Bart credit for his work, as the lightnvm bits are almost
bigger than the rest.

> +static umode_t nvm_dev_attrs_visible(struct kobject *kobj,
> +				     struct attribute *attr, int index)
>  {
> +	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct gendisk *disk = dev_to_disk(dev);
> +	struct nvme_ns *ns = disk->private_data;
>  	struct nvm_dev *ndev = ns->ndev;
> +	struct device_attribute *dev_attr =
> +		container_of(attr, typeof(*dev_attr), attr);
>  
> +	if (dev_attr->show == nvm_dev_attr_show)
> +		return attr->mode;
>  
> +	switch (ndev ? ndev->geo.major_ver_id : 0) {

How could ndev be zero here?



[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