[Cluster-devel] [PATCH dlm-tool] dlm_controld: better uevent filtering

Alexander Aring aahringo at redhat.com
Fri Jan 13 22:43:57 UTC 2023


When I did test with dlm_locktorture module I got several log messages
about:

uevent message has 3 args: add@/module/dlm_locktorture
uevent message has 3 args: remove@/module/dlm_locktorture

which are not expected and not able to parse by dlm_controld
process_uevent() function, because mismatch of argument counts.
Debugging it more, I figured out that those uevents are for
loading/unloading the dlm_locktorture module and there are uevents for
loading and unloading modules which have nothing todo with dlm lockspace
uevent handling.

The current filter works as:

if (!strstr(buf, "dlm"))

for matching the dlm joining/leaving uevent string which looks like:

offline@/kernel/dlm/locktorture

to avoid matching with other uevent which has somehow the string "dlm"
in it, we switch to the match "/dlm/" which should match only to dlm
uevent system events. Uevent uses itself '/' as a separator in the hope
that uevents cannot put a '/' as application data for an event.
---
 dlm_controld/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlm_controld/main.c b/dlm_controld/main.c
index 7cf6348e..40689c5c 100644
--- a/dlm_controld/main.c
+++ b/dlm_controld/main.c
@@ -704,7 +704,7 @@ static void process_uevent(int ci)
 		return;
 	}
 
-	if (!strstr(buf, "dlm"))
+	if (!strstr(buf, "/dlm/"))
 		return;
 
 	log_debug("uevent: %s", buf);
-- 
2.31.1



More information about the Cluster-devel mailing list