mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 07:33:19 +02:00
mnt: use ns_common_init()
Don't cargo-cult the same thing over and over. Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
90d4d9f4d2
commit
96ece8eb67
|
|
@ -4177,18 +4177,15 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns, bool a
|
|||
dec_mnt_namespaces(ucounts);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
if (!anon) {
|
||||
ret = ns_alloc_inum(&new_ns->ns);
|
||||
if (ret) {
|
||||
kfree(new_ns);
|
||||
dec_mnt_namespaces(ucounts);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
ret = ns_common_init(&new_ns->ns, &mntns_operations, !anon);
|
||||
if (ret) {
|
||||
kfree(new_ns);
|
||||
dec_mnt_namespaces(ucounts);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
new_ns->ns.ops = &mntns_operations;
|
||||
if (!anon)
|
||||
new_ns->seq = atomic64_inc_return(&mnt_ns_seq);
|
||||
refcount_set(&new_ns->ns.count, 1);
|
||||
refcount_set(&new_ns->passive, 1);
|
||||
new_ns->mounts = RB_ROOT;
|
||||
INIT_LIST_HEAD(&new_ns->mnt_ns_list);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user