Running modprobe in VE containers can't access module initstate, and
assumes the module isn't loaded, failing the module load later.

Fix by exporting /sys/module/<NAME>/initstate to VE containers.

Signed-off-by: Eva Kurchatova <[email protected]>

Feature: sysfs: Virtualize module initstate
https://virtuozzo.atlassian.net/browse/VSTOR-132134
---
 kernel/module/sysfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/module/sysfs.c b/kernel/module/sysfs.c
index 8811ef4eb4df..e181ab4a6044 100644
--- a/kernel/module/sysfs.c
+++ b/kernel/module/sysfs.c
@@ -380,7 +380,7 @@ static ssize_t module_sysfs_perm_set_ve_real(struct module 
*mod,
         * catched since they would not see their new subdirs.
         * currently the only subdir is holders.
         */
-#define VE_LONGEST_SUBDIR "holders"
+#define VE_LONGEST_SUBDIR "initstate"
 #define PERM_PATH_LEN (sizeof("module") + 2 + sizeof(VE_LONGEST_SUBDIR) + \
                                MODULE_NAME_LEN + 1)
        char path[PERM_PATH_LEN+1];
@@ -412,11 +412,14 @@ static int module_sysfs_ve_init(struct module *mod)
        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, "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.54.0

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

Reply via email to