• Home
  • Raw
  • Download

Lines Matching refs:ns

668 static inline void lock_ns_list(struct mnt_namespace *ns)  in lock_ns_list()  argument
670 spin_lock(&ns->ns_lock); in lock_ns_list()
673 static inline void unlock_ns_list(struct mnt_namespace *ns) in unlock_ns_list() argument
675 spin_unlock(&ns->ns_lock); in unlock_ns_list()
700 struct mnt_namespace *ns = current->nsproxy->mnt_ns; in __is_local_mountpoint() local
705 lock_ns_list(ns); in __is_local_mountpoint()
706 list_for_each_entry(mnt, &ns->list, mnt_list) { in __is_local_mountpoint()
713 unlock_ns_list(ns); in __is_local_mountpoint()
815 static void touch_mnt_namespace(struct mnt_namespace *ns) in touch_mnt_namespace() argument
817 if (ns) { in touch_mnt_namespace()
818 ns->event = ++event; in touch_mnt_namespace()
819 wake_up_interruptible(&ns->poll); in touch_mnt_namespace()
826 static void __touch_mnt_namespace(struct mnt_namespace *ns) in __touch_mnt_namespace() argument
828 if (ns && ns->event != event) { in __touch_mnt_namespace()
829 ns->event = event; in __touch_mnt_namespace()
830 wake_up_interruptible(&ns->poll); in __touch_mnt_namespace()
1293 static struct mount *mnt_list_next(struct mnt_namespace *ns, in mnt_list_next() argument
1298 lock_ns_list(ns); in mnt_list_next()
1299 list_for_each_continue(p, &ns->list) { in mnt_list_next()
1306 unlock_ns_list(ns); in mnt_list_next()
1319 prev = &p->ns->list; in m_start()
1328 return mnt_list_next(p->ns, prev); in m_start()
1337 return mnt_list_next(p->ns, &mnt->mnt_list); in m_next()
1345 lock_ns_list(p->ns); in m_stop()
1350 unlock_ns_list(p->ns); in m_stop()
1368 void mnt_cursor_del(struct mnt_namespace *ns, struct mount *cursor) in mnt_cursor_del() argument
1371 lock_ns_list(ns); in mnt_cursor_del()
1373 unlock_ns_list(ns); in mnt_cursor_del()
1530 struct mnt_namespace *ns; in umount_tree() local
1535 ns = p->mnt_ns; in umount_tree()
1536 if (ns) { in umount_tree()
1537 ns->mounts--; in umount_tree()
1538 __touch_mnt_namespace(ns); in umount_tree()
1809 static struct mnt_namespace *to_mnt_ns(struct ns_common *ns) in to_mnt_ns() argument
1811 return container_of(ns, struct mnt_namespace, ns); in to_mnt_ns()
1816 return &mnt->ns; in from_mnt_ns()
1919 struct mnt_namespace *ns; in dissolve_on_fput() local
1922 ns = real_mount(mnt)->mnt_ns; in dissolve_on_fput()
1923 if (ns) { in dissolve_on_fput()
1924 if (is_anon_ns(ns)) in dissolve_on_fput()
1927 ns = NULL; in dissolve_on_fput()
1931 if (ns) in dissolve_on_fput()
1932 free_mnt_ns(ns); in dissolve_on_fput()
2069 int count_mounts(struct mnt_namespace *ns, struct mount *mnt) in count_mounts() argument
2078 old = ns->mounts; in count_mounts()
2079 pending = ns->pending_mounts; in count_mounts()
2087 ns->pending_mounts = pending + mounts; in count_mounts()
2161 struct mnt_namespace *ns = dest_mnt->mnt_ns; in attach_recursive_mnt() local
2176 err = count_mounts(ns, source_mnt); in attach_recursive_mnt()
2234 ns->pending_mounts = 0; in attach_recursive_mnt()
2424 struct mnt_namespace *ns = alloc_mnt_ns(user_ns, true); in open_detached_copy() local
2428 if (IS_ERR(ns)) in open_detached_copy()
2429 return ERR_CAST(ns); in open_detached_copy()
2435 free_mnt_ns(ns); in open_detached_copy()
2441 p->mnt_ns = ns; in open_detached_copy()
2442 ns->mounts++; in open_detached_copy()
2444 ns->root = mnt; in open_detached_copy()
2445 list_add_tail(&ns->list, &mnt->mnt_list); in open_detached_copy()
2783 struct mnt_namespace *ns; in do_move_mount() local
2800 ns = old->mnt_ns; in do_move_mount()
2812 if (!(attached ? check_mnt(old) : is_anon_ns(ns))) in do_move_mount()
2858 free_mnt_ns(ns); in do_move_mount()
3353 static struct ucounts *inc_mnt_namespaces(struct user_namespace *ns) in inc_mnt_namespaces() argument
3355 return inc_ucount(ns, current_euid(), UCOUNT_MNT_NAMESPACES); in inc_mnt_namespaces()
3363 static void free_mnt_ns(struct mnt_namespace *ns) in free_mnt_ns() argument
3365 if (!is_anon_ns(ns)) in free_mnt_ns()
3366 ns_free_inum(&ns->ns); in free_mnt_ns()
3367 dec_mnt_namespaces(ns->ucounts); in free_mnt_ns()
3368 put_user_ns(ns->user_ns); in free_mnt_ns()
3369 kfree(ns); in free_mnt_ns()
3397 ret = ns_alloc_inum(&new_ns->ns); in alloc_mnt_ns()
3404 new_ns->ns.ops = &mntns_operations; in alloc_mnt_ns()
3407 refcount_set(&new_ns->ns.count, 1); in alloc_mnt_ns()
3417 struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns, in copy_mnt_ns() argument
3427 BUG_ON(!ns); in copy_mnt_ns()
3430 get_mnt_ns(ns); in copy_mnt_ns()
3431 return ns; in copy_mnt_ns()
3434 old = ns->root; in copy_mnt_ns()
3443 if (user_ns != ns->user_ns) in copy_mnt_ns()
3451 if (user_ns != ns->user_ns) { in copy_mnt_ns()
3499 struct mnt_namespace *ns; in mount_subtree() local
3504 ns = alloc_mnt_ns(&init_user_ns, true); in mount_subtree()
3505 if (IS_ERR(ns)) { in mount_subtree()
3507 return ERR_CAST(ns); in mount_subtree()
3509 mnt->mnt_ns = ns; in mount_subtree()
3510 ns->root = mnt; in mount_subtree()
3511 ns->mounts++; in mount_subtree()
3512 list_add(&mnt->mnt_list, &ns->list); in mount_subtree()
3517 put_mnt_ns(ns); in mount_subtree()
3604 struct mnt_namespace *ns; in SYSCALL_DEFINE3() local
3684 ns = alloc_mnt_ns(current->nsproxy->mnt_ns->user_ns, true); in SYSCALL_DEFINE3()
3685 if (IS_ERR(ns)) { in SYSCALL_DEFINE3()
3686 ret = PTR_ERR(ns); in SYSCALL_DEFINE3()
3690 mnt->mnt_ns = ns; in SYSCALL_DEFINE3()
3691 ns->root = mnt; in SYSCALL_DEFINE3()
3692 ns->mounts = 1; in SYSCALL_DEFINE3()
3693 list_add(&mnt->mnt_list, &ns->list); in SYSCALL_DEFINE3()
4147 struct ns_common *ns; in build_mount_idmapped() local
4174 ns = get_proc_ns(file_inode(file)); in build_mount_idmapped()
4175 if (ns->ops->type != CLONE_NEWUSER) { in build_mount_idmapped()
4188 mnt_userns = container_of(ns, struct user_namespace, ns); in build_mount_idmapped()
4332 struct mnt_namespace *ns; in init_mount_tree() local
4339 ns = alloc_mnt_ns(&init_user_ns, false); in init_mount_tree()
4340 if (IS_ERR(ns)) in init_mount_tree()
4343 m->mnt_ns = ns; in init_mount_tree()
4344 ns->root = m; in init_mount_tree()
4345 ns->mounts = 1; in init_mount_tree()
4346 list_add(&m->mnt_list, &ns->list); in init_mount_tree()
4347 init_task.nsproxy->mnt_ns = ns; in init_mount_tree()
4348 get_mnt_ns(ns); in init_mount_tree()
4393 void put_mnt_ns(struct mnt_namespace *ns) in put_mnt_ns() argument
4395 if (!refcount_dec_and_test(&ns->ns.count)) in put_mnt_ns()
4397 drop_collected_mounts(&ns->root->mnt); in put_mnt_ns()
4398 free_mnt_ns(ns); in put_mnt_ns()
4469 static bool mnt_already_visible(struct mnt_namespace *ns, in mnt_already_visible() argument
4478 lock_ns_list(ns); in mnt_already_visible()
4479 list_for_each_entry(mnt, &ns->list, mnt_list) { in mnt_already_visible()
4533 unlock_ns_list(ns); in mnt_already_visible()
4541 struct mnt_namespace *ns = current->nsproxy->mnt_ns; in mount_too_revealing() local
4544 if (ns->user_ns == &init_user_ns) in mount_too_revealing()
4558 return !mnt_already_visible(ns, sb, new_mnt_flags); in mount_too_revealing()
4576 struct ns_common *ns = NULL; in mntns_get() local
4582 ns = &nsproxy->mnt_ns->ns; in mntns_get()
4583 get_mnt_ns(to_mnt_ns(ns)); in mntns_get()
4587 return ns; in mntns_get()
4590 static void mntns_put(struct ns_common *ns) in mntns_put() argument
4592 put_mnt_ns(to_mnt_ns(ns)); in mntns_put()
4595 static int mntns_install(struct nsset *nsset, struct ns_common *ns) in mntns_install() argument
4599 struct mnt_namespace *mnt_ns = to_mnt_ns(ns), *old_mnt_ns; in mntns_install()
4639 static struct user_namespace *mntns_owner(struct ns_common *ns) in mntns_owner() argument
4641 return to_mnt_ns(ns)->user_ns; in mntns_owner()