[Devel] [PATCH RHEL COMMIT] kernfs/ve: ignore kernfs 've_perms_map' in cgroups.

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 4 20:39:03 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 232988baf46cc533e5f8c75f7ac7578fe99e5009
Author: Valeriy.Vdovin <valeriy.vdovin at virtuozzo.com>
Date:   Mon Oct 4 20:39:03 2021 +0300

    kernfs/ve: ignore kernfs 've_perms_map' in cgroups.
    
    Kernfs implements file permissions logic, that relies on
    (struct kernfs_node).ve_perms_map. In VZ8 cgroups have been modified
    to use kernfs, but cgroups do not benefit from using ve_perms_map in
    any way so it's left uninitialized in cgroup code. There is no clear
    way of implementing any kind of stub ve_perms_map for cgroups, so it
    seems the best logic is to allow the field exist as NULL for those
    who uses kernfs but don't wish to use ve_perms_map.
    
    https://jira.sw.ru/browse/PSBM-104455
    
    Signed-off-by: Valeriy.Vdovin <valeriy.vdovin at virtuozzo.com>
    
    Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    
    (cherry picked from vz8 commit 81cf32167e09ac0c0240991070e069f91c0eda6d)
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 fs/kernfs/ve.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/kernfs/ve.c b/fs/kernfs/ve.c
index 8abb020de40f..ea8b583c8d8f 100644
--- a/fs/kernfs/ve.c
+++ b/fs/kernfs/ve.c
@@ -123,6 +123,15 @@ bool kernfs_d_visible(struct kernfs_node *kn, struct kernfs_super_info *info)
 	if (kernfs_type(kn) == KERNFS_LINK)
 		kn = kn->symlink.target_kn;
 
+	/*
+	 * Some systems that are built on top of kernfs might
+	 * not want to use ve_perms_map (cgroup is an example)
+	 * so they leave ve_perms_map uninitialized.
+	 * For them we just true.
+	 */
+	if (!kn->ve_perms_map)
+		return true;
+
 	return !!kmapset_get_value(kn->ve_perms_map,
 				   kernfs_info_perms_key(info));
 }


More information about the Devel mailing list