util/sysfs: do not fail on missing bind attributes
Alison Schofield
maintainerPATCH 1/1 util/sysfs: do not fail on missing bind attributes
From: Tao Xu <[email protected]>
Kernel commit cb9cfff82f6a ("cxl/acpi: Simplify cxl_nvdimm_bridge probing") removed bind attrributes for cxl_pmem_region and cxl_nvdimm* objects.
__util_bind() currently attempts to write to the bind attribute of every entry under /sys/bus/cxl/drivers/. On kernels where some driver directories no longer provide that attribute, these attempts fail with ENOENT and produce misleading bind errors.
Check that the bind attribute exists before attempting the write.
[ as: commit log edited ]
--- util/sysfs.c | 5 +++++ 1 file changed, 5 insertions(+)
util/sysfs.c +5 -0
@@ -258,6 +258,11 @@ int __util_bind(const char *devname, struct kmod_module *module,continue ; } +if (access (drv_path,F_OK ) !=0 ) { +free (drv_path); +continue ; + } + rc =__sysfs_write_attr_quiet (ctx, drv_path, devname);free (drv_path);if (rc ==0 )
Signature · 1 line
2.37.3
Quoted 13 lines · Alison Schofield
From: Tao Xu <[email protected]>
Kernel commit
cb9cfff82f6a("cxl/acpi: Simplifycxl_nvdimm_bridgeprobing") removed bind attrributes forcxl_pmem_regionand cxl_nvdimm* objects.
__util_bind()currently attempts to write to the bind attribute of every entry under/sys/bus/cxl/drivers/. On kernels where some driver directories no longer provide that attribute, these attempts fail with ENOENT and produce misleading bind errors.Check that the bind attribute exists before attempting the write.
Quoted 7 lines
[ as: commit log edited ]
Reported-by Tao Xu <[email protected]>Signed-off-by Tao Xu <[email protected]>Reviewed-by Alison Schofield <[email protected]>Signed-off-by Alison Schofield <[email protected]>
Applied to pending for NDCTL v86
https://github.com/pmem/ndctl/commit/3c8c3538a450