[LTP] [PATCH v1 1/1] syscalls/<delete, init, finit>_module: Rename /proc/dummy to module specific path name
Nirjhar Roy
nirjhar@linux.ibm.com
Mon Sep 9 06:42:34 CEST 2024
Tests in syscalls/delete_module/, syscalls/init_module and syscalls/finit_module use kernel
modules all of which create a /proc/dummy node. When these tests run in parralel, there appears
to be a situation where these tests simulatenously tries to create /proc/dummy node. This generates
a kernel warning "proc_dir_entry '/proc/dummy' already registered".
This patch renames the /proc/dummy node to module specific name in order to avoid the conflict.
Signed-off-by: Nirjhar Roy <nirjhar@linux.ibm.com>
---
testcases/kernel/syscalls/delete_module/dummy_del_mod.c | 6 ++++--
testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c | 6 ++++--
testcases/kernel/syscalls/finit_module/finit_module.c | 6 ++++--
testcases/kernel/syscalls/init_module/init_module.c | 6 ++++--
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/testcases/kernel/syscalls/delete_module/dummy_del_mod.c b/testcases/kernel/syscalls/delete_module/dummy_del_mod.c
index 0ca7bea37..4257bb504 100644
--- a/testcases/kernel/syscalls/delete_module/dummy_del_mod.c
+++ b/testcases/kernel/syscalls/delete_module/dummy_del_mod.c
@@ -14,6 +14,8 @@
#include <linux/proc_fs.h>
#include <linux/kernel.h>
+#define DIRNAME "dummy_delmod"
+
/* Dummy function called by dependent module */
int dummy_func_test(void)
{
@@ -25,13 +27,13 @@ static int __init dummy_init(void)
{
struct proc_dir_entry *proc_dummy;
- proc_dummy = proc_mkdir("dummy", 0);
+ proc_dummy = proc_mkdir(DIRNAME, 0);
return 0;
}
static void __exit dummy_exit(void)
{
- remove_proc_entry("dummy", 0);
+ remove_proc_entry(DIRNAME, 0);
}
module_init(dummy_init);
diff --git a/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c b/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c
index 85b327911..8c891cf49 100644
--- a/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c
+++ b/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c
@@ -16,20 +16,22 @@
#include <linux/proc_fs.h>
#include <linux/kernel.h>
+#define DIRNAME "dummy_dep"
+
extern int dummy_func_test(void);
static int __init dummy_init(void)
{
struct proc_dir_entry *proc_dummy;
- proc_dummy = proc_mkdir("dummy_dep", 0);
+ proc_dummy = proc_mkdir(DIRNAME, 0);
dummy_func_test();
return 0;
}
static void __exit dummy_exit(void)
{
- remove_proc_entry("dummy_dep", 0);
+ remove_proc_entry(DIRNAME, 0);
}
module_init(dummy_init);
diff --git a/testcases/kernel/syscalls/finit_module/finit_module.c b/testcases/kernel/syscalls/finit_module/finit_module.c
index 78d03b899..a7b1e43c5 100644
--- a/testcases/kernel/syscalls/finit_module/finit_module.c
+++ b/testcases/kernel/syscalls/finit_module/finit_module.c
@@ -13,6 +13,8 @@
#include <linux/proc_fs.h>
#include <linux/kernel.h>
+#define DIRNAME "dummy_finit"
+
static char status[20];
module_param_string(status, status, 20, 0444);
@@ -23,14 +25,14 @@ static int dummy_init(void)
if (!strcmp(status, "invalid"))
return -EINVAL;
- proc_dummy = proc_mkdir("dummy", 0);
+ proc_dummy = proc_mkdir(DIRNAME, 0);
return 0;
}
module_init(dummy_init);
static void dummy_exit(void)
{
- remove_proc_entry("dummy", 0);
+ remove_proc_entry(DIRNAME, 0);
}
module_exit(dummy_exit);
diff --git a/testcases/kernel/syscalls/init_module/init_module.c b/testcases/kernel/syscalls/init_module/init_module.c
index 78d03b899..f14cd80b6 100644
--- a/testcases/kernel/syscalls/init_module/init_module.c
+++ b/testcases/kernel/syscalls/init_module/init_module.c
@@ -13,6 +13,8 @@
#include <linux/proc_fs.h>
#include <linux/kernel.h>
+#define DIRNAME "dummy_init"
+
static char status[20];
module_param_string(status, status, 20, 0444);
@@ -23,14 +25,14 @@ static int dummy_init(void)
if (!strcmp(status, "invalid"))
return -EINVAL;
- proc_dummy = proc_mkdir("dummy", 0);
+ proc_dummy = proc_mkdir(DIRNAME, 0);
return 0;
}
module_init(dummy_init);
static void dummy_exit(void)
{
- remove_proc_entry("dummy", 0);
+ remove_proc_entry(DIRNAME, 0);
}
module_exit(dummy_exit);
--
2.43.5
More information about the ltp
mailing list