diff options
author | Eric W. Biederman <ebiederm@aristanetworks.com> | 2011-08-11 16:40:03 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@aristanetworks.com> | 2011-08-11 17:52:02 -0500 |
commit | dc2db4f10e37591ca66ee13f567fe76e72fdf720 (patch) | |
tree | 70d548169bc5b8a3fc4459f198e2dade4b27767a | |
parent | 64efb69d6d52c1e20daec908ba8accd8a0393fbd (diff) | |
download | linux-user-ns-devel-dc2db4f10e37591ca66ee13f567fe76e72fdf720.tar.gz |
ext4: Support specifying the usernamespace on mount.
-rw-r--r-- | fs/ext4/super.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 4687fea0c00f24..e613e3326af028 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -43,6 +43,7 @@ #include <linux/kthread.h> #include <linux/freezer.h> +#include <linux/user_namespace.h> #include "ext4.h" #include "ext4_jbd2.h" @@ -1321,6 +1322,7 @@ enum { Opt_dioread_nolock, Opt_dioread_lock, Opt_discard, Opt_nodiscard, Opt_init_inode_table, Opt_noinit_inode_table, + Opt_userns, }; static const match_table_t tokens = { @@ -1396,6 +1398,7 @@ static const match_table_t tokens = { {Opt_init_inode_table, "init_itable=%u"}, {Opt_init_inode_table, "init_itable"}, {Opt_noinit_inode_table, "noinit_itable"}, + {Opt_userns, "userns=%u"}, {Opt_err, NULL}, }; @@ -1886,6 +1889,18 @@ set_qf_format: case Opt_noinit_inode_table: clear_opt(sb, INIT_INODE_TABLE); break; + case Opt_userns: + { + struct user_namespace *new_user_ns; + if (match_int(&args[0], &option)) + return 0; + new_user_ns = get_user_ns_by_fd(option); + if (IS_ERR(new_user_ns)) + return 0; + put_user_ns(sb->s_user_ns); + sb->s_user_ns = new_user_ns; + break; + } default: ext4_msg(sb, KERN_ERR, "Unrecognized mount option \"%s\" " |