File daxctl-Skip-over-memory-failure-node-status.patch of Package ndctl
From 9b81c4af4b862b4fdc43e8057ec4c132253dbae2 Mon Sep 17 00:00:00 2001
From: Adam Manzanares <a.manzanares@samsung.com>
Date: Mon, 13 Feb 2023 21:39:15 +0000
Subject: [PATCH 1/6] daxctl: Skip over memory failure node status
Upstream: v76
Git-commit: 9b81c4af4b862b4fdc43e8057ec4c132253dbae2
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.manzanares@samsung.com>
Link: https://lore.kernel.org/r/20230213213853.436788-1-a.manzanares@samsung.com
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.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.1