[Devel] [PATCH rh7] ve/module: export "initstate" per-module sysfs dentries in containers

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 12 20:15:58 MSK 2020


Kubernetes tries to load modules inside a Container using "modprobe" and
expectedly fails and complains even if the module is already loaded.

Let's provide "/sys/module/<NAME>/initstate" dentries in Containers,
modprobe does check them in order to avoid redundant attempt to load
a module if it's already loaded.

https://jira.sw.ru/browse/PSBM-103989

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 kernel/module.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 799b365aae7fd..e4fb6505cd186 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1821,13 +1821,16 @@ static int module_sysfs_ve_init(struct module *mod)
 	int err;
 
 	err = module_sysfs_expose_dir_ve(mod, NULL);
-	if (!err)
-		err = module_sysfs_expose_dir_ve(mod, "holders");
+	if (!err) {
+		err  = module_sysfs_expose_dir_ve(mod, "holders");
+		err |= module_sysfs_expose_dir_ve(mod, "initstate");
+	}
 	return err;
 }
 
 static void module_sysfs_ve_fini(struct module *mod)
 {
+	(void) module_sysfs_hide_dir_ve(mod, "initstate");
 	(void) module_sysfs_hide_dir_ve(mod, "holders");
 	(void) module_sysfs_hide_dir_ve(mod, NULL);
 }
-- 
2.15.1



More information about the Devel mailing list