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

Submitted by Konstantin Khorenko on May 12, 2020, 5:15 p.m.

Details

Message ID 20200512171558.3691-1-khorenko@virtuozzo.com
State New
Series "ve/module: export "initstate" per-module sysfs dentries in containers"
Headers show

Commit Message

Konstantin Khorenko May 12, 2020, 5:15 p.m.
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@virtuozzo.com>
---
 kernel/module.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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);
 }