• Dan Williams's avatar
    device-dax: fix sysfs duplicate warnings · bbb3be17
    Dan Williams authored
    Fix warnings of the form...
    
         WARNING: CPU: 10 PID: 4983 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x62/0x80
         sysfs: cannot create duplicate filename '/class/dax/dax12.0'
         Call Trace:
          dump_stack+0x63/0x86
          __warn+0xcb/0xf0
          warn_slowpath_fmt+0x5a/0x80
          ? kernfs_path_from_node+0x4f/0x60
          sysfs_warn_dup+0x62/0x80
          sysfs_do_create_link_sd.isra.2+0x97/0xb0
          sysfs_create_link+0x25/0x40
          device_add+0x266/0x630
          devm_create_dax_dev+0x2cf/0x340 [dax]
          dax_pmem_probe+0x1f5/0x26e [dax_pmem]
          nvdimm_bus_probe+0x71/0x120
    
    ...by reusing the namespace id for the device-dax instance name.
    
    Now that we have decided that there will never by more than one
    device-dax instance per libnvdimm-namespace parent device [1], we can
    directly reuse the namepace ids. There are some possible follow-on
    cleanups, but those are saved for a later patch to simplify the -stable
    backport.
    
    [1]: https://lists.01.org/pipermail/linux-nvdimm/2016-December/008266.html
    
    Fixes: 98a29c39 ("libnvdimm, namespace: allow creation of multiple pmem...")
    Cc: Jeff Moyer <jmoyer@redhat.com>
    Cc: <stable@vger.kernel.org>
    Reported-by: default avatarDariusz Dokupil <dariusz.dokupil@intel.com>
    Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    bbb3be17
device.c 16.6 KB