Re: [PATCH 2/5] nvme: register ns_id attributes as default sysfs groups
From: Hannes Reinecke <hare@suse.de>
Date: 2018-09-05 13:32:03
Also in:
linux-nvme
On 09/05/2018 03:18 PM, Christoph Hellwig wrote:
On Wed, Sep 05, 2018 at 09:00:50AM +0200, Hannes Reinecke wrote:quoted
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.
Okay, will be doing so.
quoted
+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?
For 'normal' NVMe devices (ie non-lightnvm). As we now register all sysfs attributes (including the lightnvm ones) per default we'll need to blank them out for non-lightnvm devices. Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)