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 <[email protected]>
---
 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

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to