On Fri, Aug 10, 2018 at 05:00:22PM -0700, Bart Van Assche wrote:
For the udev rules that create symbolic links under /dev it is essential that all sysfs attributes are registered before an object becomes visible. This patch avoids that udevd fails to create the /dev/disk/by-id/nvme-uuid.* symbolic link.
It's nice to see this finally get fixed up :)
Fixes: 2b9b6e86bca7 ("NVMe: Export namespace attributes to sysfs") Signed-off-by: Bart Van Assche bart.vanassche@wdc.com Cc: Keith Busch keith.busch@intel.com Cc: Sagi Grimberg sagi@grimberg.me Cc: Matias Bjorling mb@lightnvm.io Cc: stable@vger.kernel.org
drivers/nvme/host/core.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index dd8ec1dd9219..f4b880c8abe6 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2734,6 +2734,11 @@ const struct attribute_group nvme_ns_id_attr_group = { .is_visible = nvme_ns_id_attrs_are_visible, }; +static const struct attribute_group *nvme_attr_groups[] = {
- &nvme_ns_id_attr_group,
- NULL
+};
#define nvme_show_str_function(field) \ static ssize_t field##_show(struct device *dev, \ struct device_attribute *attr, char *buf) \ @@ -3099,11 +3104,13 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) nvme_get_ctrl(ctrl);
- WARN_ON_ONCE(disk_to_dev(ns->disk)->groups);
Why? Who is going to care or be able to do anything about this if it triggers?
- disk_to_dev(ns->disk)->groups = nvme_attr_groups; device_add_disk(ctrl->device, ns->disk);
- if (sysfs_create_group(&disk_to_dev(ns->disk)->kobj,
&nvme_ns_id_attr_group))
pr_warn("%s: failed to create sysfs group for identification\n",
ns->disk->disk_name);
- /*
* To do: remove nvme_nvm_register_sysfs() and add the nvm attribute
* groups to nvme_attr_groups.
*/
Why not do that now? And normally it is "TODO" not "To do" to make it easier to search for.
thanks,
greg k-h