[Devel] [PATCH RHEL COMMIT] ve/fs: allow devices-realted mounts in VE initial user namespace

Konstantin Khorenko khorenko at virtuozzo.com
Wed Sep 22 14:50:57 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 064172f07a02d3df71426ff319bd339c289073ad
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date:   Wed Sep 22 14:50:57 2021 +0300

    ve/fs: allow devices-realted mounts in VE initial user namespace
    
    This is needed to be able to open device files on mounts, created in
    containers root user namespace.
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
    
    (cherry-picked from vz8 commit dd1beccb211a934396cf5e0ec6948ed0d42e41b5)
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 fs/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 91b7f156735b..45e6e73db933 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -37,6 +37,7 @@
 #include <linux/lockdep.h>
 #include <linux/user_namespace.h>
 #include <linux/fs_context.h>
+#include <linux/ve.h>
 #include <uapi/linux/mount.h>
 #include "internal.h"
 
@@ -240,7 +241,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags,
 	init_waitqueue_head(&s->s_writers.wait_unfrozen);
 	s->s_bdi = &noop_backing_dev_info;
 	s->s_flags = flags;
-	if (s->s_user_ns != &init_user_ns)
+	if (!current_user_ns_initial())
 		s->s_iflags |= SB_I_NODEV;
 	INIT_HLIST_NODE(&s->s_instances);
 	INIT_HLIST_BL_HEAD(&s->s_roots);


More information about the Devel mailing list