[Devel] [PATCH vz10] ve/module: export sysfs initstate in containers

Eva Kurchatova eva.kurchatova at virtuozzo.com
Sun Jun 7 20:48:29 MSK 2026


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 <eva.kurchatova at virtuozzo.com>

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



More information about the Devel mailing list