When trying to match a dax device to a memblock physical address
memblock_in_dev will fail if the the phys_index sysfs file does
not exist in the memblock. Currently the memory failure directory
associated with a node is currently interpreted as a memblock.
Skip over the memory_failure directory within the node directory.

Signed-off-by: Adam Manzanares <a.manzana...@samsung.com>
---
 daxctl/lib/libdaxctl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
index d990479..b27a8af 100644
--- a/daxctl/lib/libdaxctl.c
+++ b/daxctl/lib/libdaxctl.c
@@ -1552,6 +1552,8 @@ static int daxctl_memory_op(struct daxctl_memory *mem, 
enum memory_op op)
        errno = 0;
        while ((de = readdir(node_dir)) != NULL) {
                if (strncmp(de->d_name, "memory", 6) == 0) {
+                       if (strncmp(de->d_name, "memory_", 7) == 0)
+                               continue;
                        rc = memblock_in_dev(mem, de->d_name);
                        if (rc < 0)
                                goto out_dir;
-- 
2.39.0

Reply via email to