[Devel] [PATCH RH9 2/6] Date: Wed Oct 7 14:47:07 2015 +0400

Kirill Tkhai ktkhai at virtuozzo.com
Tue Oct 5 18:42:31 MSK 2021


ve/fs: Allow to mount ext4 in top CT userns

https://jira.sw.ru/browse/PSBM-40100

v2: Check that user_ns is initial for the ve.
v3: Be sure ve->init_cred is set.

Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
Acked-by: Vladimir Davydov <vdavydov at virtuozzo.com>

khorenko@: in fact we allowed to do those mounts in top CT user ns only.

(cherry picked from vz7 commit d8aabe8924283e12ef30dee49253f91f33d3e9bc
("ve/fs: Allow to mount ext4 and binfmt_misc under non-root ns"))
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>

+++
ve/fs: Allow to mount ext4 in top CT userns - cleanup

After commit d5c3320347bb ("fs/ve: add new FS_VE_MOUNT flag to allow mount
in container init userns") it's wise to use FS_VE_MOUNT flag
instead of generic FS_USERNS_MOUNT + additional per-fs check.

This patch does not change the behavior.

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/ext4/super.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3bc2cfb04518..03ade65fbe51 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -40,6 +40,7 @@
 #include <linux/crc16.h>
 #include <linux/dax.h>
 #include <linux/cleancache.h>
+#include <linux/ve.h>
 #include <linux/uaccess.h>
 #include <linux/iversion.h>
 #include <linux/unicode.h>
@@ -6783,7 +6784,8 @@ static struct file_system_type ext4_fs_type = {
 	.name		= "ext4",
 	.mount		= ext4_mount,
 	.kill_sb	= ext4_kill_sb,
-	.fs_flags	= FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_VIRTUALIZED,
+	.fs_flags	= FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_VIRTUALIZED |
+			  FS_VE_MOUNT,
 };
 MODULE_ALIAS_FS("ext4");
 




More information about the Devel mailing list