[Devel] [PATCH vz9 12/20] xfs: Allow to mount XFS in non-init userns

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Wed Oct 13 18:26:23 MSK 2021


From: Konstantin Khorenko <khorenko at virtuozzo.com>

At the moment XFS is not marked as ready to be mounted inside non-init
userns (see xfs_fs_type), while we previously decided to allow using XFS
inside a CT:
  b86b9049ba50 ("xfs: allow to mount xfs fs inside a Container")
  https://jira.sw.ru/browse/PSBM-72401

so let's mark XFS as mount-able inside non-init userns.

mFixes: b86b9049ba50 ("xfs: allow to mount xfs fs inside a Container")
https://jira.sw.ru/browse/PSBM-86369

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>

eshatokhin@:
Used FS_VE_MOUNT as suggested by Pavel Tikhomirov (ptikhomirov@) instead
of FS_USERNS_MOUNT: it is better to allow mounts only from the init
userns of a container rather than from just any userns.

Cherry-picked from vz7 commit b86b9049ba50 ("xfs: allow to mount xfs fs
inside a Container")

Done in the scope of https://jira.sw.ru/browse/PSBM-127830.
Signed-off-by: Evgenii Shatokhin <eshatokhin at virtuozzo.com>

(cherry-picked from vz8 commit 7d3dd4eb58f8 ("xfs: Allow to mount XFS in
non-init userns"))

Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 fs/xfs/xfs_super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 304875c0d3cc..fd1cd6aacd10 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1888,7 +1888,7 @@ static struct file_system_type xfs_fs_type = {
 	.init_fs_context	= xfs_init_fs_context,
 	.parameters		= xfs_fs_parameters,
 	.kill_sb		= kill_block_super,
-	.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("xfs");
 
-- 
2.30.2



More information about the Devel mailing list