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

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 19 20:55:04 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.16.1.12.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.16.1.12.4.vz10
------>
commit e08651f9ec9d128ff7348803455be3554f31fc82
Author: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Date:   Tue Jun 16 12:28:41 2026 +0300

    ve/module: export sysfs initstate in containers
    
    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.
    
    Feature: sysfs: Virtualize module initstate
    https://virtuozzo.atlassian.net/browse/VSTOR-132134
    Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
 kernel/module/sysfs.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/module/sysfs.c b/kernel/module/sysfs.c
index 4d0286559123d..bc3ffc142b778 100644
--- a/kernel/module/sysfs.c
+++ b/kernel/module/sysfs.c
@@ -371,10 +371,10 @@ static ssize_t module_sysfs_perm_set_ve_real(struct module *mod,
 	/*
 	 * To avoid using 4K stack space we can calculate max possible path
 	 * If new users came this must be updated but it will be quickly
-	 * catched since they would not see their new subdirs.
-	 * currently the only subdir is holders.
+	 * caught since they would not see their new subdirs.
+	 * Currently holders (dir) and initstate (file).
 	 */
-#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];
@@ -406,11 +406,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);
 }


More information about the Devel mailing list