Lines Matching refs:mnt
261 static inline struct hlist_head *m_hash(struct vfsmount *mnt, struct dentry *dentry) in m_hash() argument
263 unsigned long tmp = ((unsigned long)mnt / L1_CACHE_BYTES); in m_hash()
276 static int mnt_alloc_id(struct mount *mnt) in mnt_alloc_id() argument
281 res = __xa_alloc(&mnt_id_xa, &mnt->mnt_id, mnt, XA_LIMIT(1, INT_MAX), GFP_KERNEL); in mnt_alloc_id()
283 mnt->mnt_id_unique = ++mnt_id_ctr; in mnt_alloc_id()
288 static void mnt_free_id(struct mount *mnt) in mnt_free_id() argument
290 xa_erase(&mnt_id_xa, mnt->mnt_id); in mnt_free_id()
296 static int mnt_alloc_group_id(struct mount *mnt) in mnt_alloc_group_id() argument
302 mnt->mnt_group_id = res; in mnt_alloc_group_id()
309 void mnt_release_group_id(struct mount *mnt) in mnt_release_group_id() argument
311 ida_free(&mnt_group_ida, mnt->mnt_group_id); in mnt_release_group_id()
312 mnt->mnt_group_id = 0; in mnt_release_group_id()
318 static inline void mnt_add_count(struct mount *mnt, int n) in mnt_add_count() argument
321 this_cpu_add(mnt->mnt_pcp->mnt_count, n); in mnt_add_count()
324 mnt->mnt_count += n; in mnt_add_count()
332 int mnt_get_count(struct mount *mnt) in mnt_get_count() argument
339 count += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_count; in mnt_get_count()
344 return mnt->mnt_count; in mnt_get_count()
350 struct mount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL); in alloc_vfsmnt() local
351 if (mnt) { in alloc_vfsmnt()
354 err = mnt_alloc_id(mnt); in alloc_vfsmnt()
359 mnt->mnt_devname = kstrdup_const(name, in alloc_vfsmnt()
361 if (!mnt->mnt_devname) in alloc_vfsmnt()
366 mnt->mnt_pcp = alloc_percpu(struct mnt_pcp); in alloc_vfsmnt()
367 if (!mnt->mnt_pcp) in alloc_vfsmnt()
370 this_cpu_add(mnt->mnt_pcp->mnt_count, 1); in alloc_vfsmnt()
372 mnt->mnt_count = 1; in alloc_vfsmnt()
373 mnt->mnt_writers = 0; in alloc_vfsmnt()
376 INIT_HLIST_NODE(&mnt->mnt_hash); in alloc_vfsmnt()
377 INIT_LIST_HEAD(&mnt->mnt_child); in alloc_vfsmnt()
378 INIT_LIST_HEAD(&mnt->mnt_mounts); in alloc_vfsmnt()
379 INIT_LIST_HEAD(&mnt->mnt_list); in alloc_vfsmnt()
380 INIT_LIST_HEAD(&mnt->mnt_expire); in alloc_vfsmnt()
381 INIT_LIST_HEAD(&mnt->mnt_share); in alloc_vfsmnt()
382 INIT_LIST_HEAD(&mnt->mnt_slave_list); in alloc_vfsmnt()
383 INIT_LIST_HEAD(&mnt->mnt_slave); in alloc_vfsmnt()
384 INIT_HLIST_NODE(&mnt->mnt_mp_list); in alloc_vfsmnt()
385 INIT_LIST_HEAD(&mnt->mnt_umounting); in alloc_vfsmnt()
386 INIT_HLIST_HEAD(&mnt->mnt_stuck_children); in alloc_vfsmnt()
387 RB_CLEAR_NODE(&mnt->mnt_node); in alloc_vfsmnt()
388 mnt->mnt.mnt_idmap = &nop_mnt_idmap; in alloc_vfsmnt()
390 return mnt; in alloc_vfsmnt()
394 kfree_const(mnt->mnt_devname); in alloc_vfsmnt()
397 mnt_free_id(mnt); in alloc_vfsmnt()
399 kmem_cache_free(mnt_cache, mnt); in alloc_vfsmnt()
422 bool __mnt_is_readonly(struct vfsmount *mnt) in __mnt_is_readonly() argument
424 return (mnt->mnt_flags & MNT_READONLY) || sb_rdonly(mnt->mnt_sb); in __mnt_is_readonly()
428 static inline void mnt_inc_writers(struct mount *mnt) in mnt_inc_writers() argument
431 this_cpu_inc(mnt->mnt_pcp->mnt_writers); in mnt_inc_writers()
433 mnt->mnt_writers++; in mnt_inc_writers()
437 static inline void mnt_dec_writers(struct mount *mnt) in mnt_dec_writers() argument
440 this_cpu_dec(mnt->mnt_pcp->mnt_writers); in mnt_dec_writers()
442 mnt->mnt_writers--; in mnt_dec_writers()
446 static unsigned int mnt_get_writers(struct mount *mnt) in mnt_get_writers() argument
453 count += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_writers; in mnt_get_writers()
458 return mnt->mnt_writers; in mnt_get_writers()
462 static int mnt_is_readonly(struct vfsmount *mnt) in mnt_is_readonly() argument
464 if (READ_ONCE(mnt->mnt_sb->s_readonly_remount)) in mnt_is_readonly()
475 return __mnt_is_readonly(mnt); in mnt_is_readonly()
496 struct mount *mnt = real_mount(m); in mnt_get_write_access() local
500 mnt_inc_writers(mnt); in mnt_get_write_access()
508 while (READ_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD) { in mnt_get_write_access()
534 mnt_dec_writers(mnt); in mnt_get_write_access()
580 if (__mnt_is_readonly(file->f_path.mnt)) in mnt_get_write_access_file()
584 return mnt_get_write_access(file->f_path.mnt); in mnt_get_write_access_file()
616 void mnt_put_write_access(struct vfsmount *mnt) in mnt_put_write_access() argument
619 mnt_dec_writers(real_mount(mnt)); in mnt_put_write_access()
632 void mnt_drop_write(struct vfsmount *mnt) in mnt_drop_write() argument
634 mnt_put_write_access(mnt); in mnt_drop_write()
635 sb_end_write(mnt->mnt_sb); in mnt_drop_write()
642 mnt_put_write_access(file->f_path.mnt); in mnt_put_write_access_file()
670 static inline int mnt_hold_writers(struct mount *mnt) in mnt_hold_writers() argument
672 mnt->mnt.mnt_flags |= MNT_WRITE_HOLD; in mnt_hold_writers()
695 if (mnt_get_writers(mnt) > 0) in mnt_hold_writers()
713 static inline void mnt_unhold_writers(struct mount *mnt) in mnt_unhold_writers() argument
720 mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD; in mnt_unhold_writers()
723 static int mnt_make_readonly(struct mount *mnt) in mnt_make_readonly() argument
727 ret = mnt_hold_writers(mnt); in mnt_make_readonly()
729 mnt->mnt.mnt_flags |= MNT_READONLY; in mnt_make_readonly()
730 mnt_unhold_writers(mnt); in mnt_make_readonly()
736 struct mount *mnt; in sb_prepare_remount_readonly() local
744 list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) { in sb_prepare_remount_readonly()
745 if (!(mnt->mnt.mnt_flags & MNT_READONLY)) { in sb_prepare_remount_readonly()
746 err = mnt_hold_writers(mnt); in sb_prepare_remount_readonly()
756 list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) { in sb_prepare_remount_readonly()
757 if (mnt->mnt.mnt_flags & MNT_WRITE_HOLD) in sb_prepare_remount_readonly()
758 mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD; in sb_prepare_remount_readonly()
765 static void free_vfsmnt(struct mount *mnt) in free_vfsmnt() argument
767 mnt_idmap_put(mnt_idmap(&mnt->mnt)); in free_vfsmnt()
768 kfree_const(mnt->mnt_devname); in free_vfsmnt()
770 free_percpu(mnt->mnt_pcp); in free_vfsmnt()
772 kmem_cache_free(mnt_cache, mnt); in free_vfsmnt()
783 struct mount *mnt; in __legitimize_mnt() local
788 mnt = real_mount(bastard); in __legitimize_mnt()
789 mnt_add_count(mnt, 1); in __legitimize_mnt()
795 mnt_add_count(mnt, -1); in __legitimize_mnt()
838 struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry) in __lookup_mnt() argument
840 struct hlist_head *head = m_hash(mnt, dentry); in __lookup_mnt()
844 if (&p->mnt_parent->mnt == mnt && p->mnt_mountpoint == dentry) in __lookup_mnt()
874 child_mnt = __lookup_mnt(path->mnt, path->dentry); in lookup_mnt()
875 m = child_mnt ? &child_mnt->mnt : NULL; in lookup_mnt()
899 struct mount *mnt, *n; in __is_local_mountpoint() local
903 rbtree_postorder_for_each_entry_safe(mnt, n, &ns->mounts, mnt_node) { in __is_local_mountpoint()
904 is_covered = (mnt->mnt_mountpoint == dentry); in __is_local_mountpoint()
1001 static inline int check_mnt(struct mount *mnt) in check_mnt() argument
1003 return mnt->mnt_ns == current->nsproxy->mnt_ns; in check_mnt()
1006 static inline bool check_anonymous_mnt(struct mount *mnt) in check_anonymous_mnt() argument
1010 if (!is_anon_ns(mnt->mnt_ns)) in check_anonymous_mnt()
1013 seq = mnt->mnt_ns->seq_origin; in check_anonymous_mnt()
1042 static struct mountpoint *unhash_mnt(struct mount *mnt) in unhash_mnt() argument
1045 mnt->mnt_parent = mnt; in unhash_mnt()
1046 mnt->mnt_mountpoint = mnt->mnt.mnt_root; in unhash_mnt()
1047 list_del_init(&mnt->mnt_child); in unhash_mnt()
1048 hlist_del_init_rcu(&mnt->mnt_hash); in unhash_mnt()
1049 hlist_del_init(&mnt->mnt_mp_list); in unhash_mnt()
1050 mp = mnt->mnt_mp; in unhash_mnt()
1051 mnt->mnt_mp = NULL; in unhash_mnt()
1058 static void umount_mnt(struct mount *mnt) in umount_mnt() argument
1060 put_mountpoint(unhash_mnt(mnt)); in umount_mnt()
1066 void mnt_set_mountpoint(struct mount *mnt, in mnt_set_mountpoint() argument
1071 mnt_add_count(mnt, 1); /* essentially, that's mntget */ in mnt_set_mountpoint()
1073 child_mnt->mnt_parent = mnt; in mnt_set_mountpoint()
1105 static void __attach_mnt(struct mount *mnt, struct mount *parent) in __attach_mnt() argument
1107 hlist_add_head_rcu(&mnt->mnt_hash, in __attach_mnt()
1108 m_hash(&parent->mnt, mnt->mnt_mountpoint)); in __attach_mnt()
1109 list_add_tail(&mnt->mnt_child, &parent->mnt_mounts); in __attach_mnt()
1134 static void attach_mnt(struct mount *mnt, struct mount *parent, in attach_mnt() argument
1138 mnt_set_mountpoint_beneath(mnt, parent, mp); in attach_mnt()
1140 mnt_set_mountpoint(parent, mp, mnt); in attach_mnt()
1147 __attach_mnt(mnt, mnt->mnt_parent); in attach_mnt()
1150 void mnt_change_mountpoint(struct mount *parent, struct mountpoint *mp, struct mount *mnt) in mnt_change_mountpoint() argument
1152 struct mountpoint *old_mp = mnt->mnt_mp; in mnt_change_mountpoint()
1153 struct mount *old_parent = mnt->mnt_parent; in mnt_change_mountpoint()
1155 list_del_init(&mnt->mnt_child); in mnt_change_mountpoint()
1156 hlist_del_init(&mnt->mnt_mp_list); in mnt_change_mountpoint()
1157 hlist_del_init_rcu(&mnt->mnt_hash); in mnt_change_mountpoint()
1159 attach_mnt(mnt, parent, mp, false); in mnt_change_mountpoint()
1170 static void mnt_add_to_ns(struct mnt_namespace *ns, struct mount *mnt) in mnt_add_to_ns() argument
1176 WARN_ON(mnt_ns_attached(mnt)); in mnt_add_to_ns()
1177 mnt->mnt_ns = ns; in mnt_add_to_ns()
1180 if (mnt->mnt_id_unique < node_to_mount(parent)->mnt_id_unique) { in mnt_add_to_ns()
1190 ns->mnt_last_node = &mnt->mnt_node; in mnt_add_to_ns()
1192 ns->mnt_first_node = &mnt->mnt_node; in mnt_add_to_ns()
1193 rb_link_node(&mnt->mnt_node, parent, link); in mnt_add_to_ns()
1194 rb_insert_color(&mnt->mnt_node, &ns->mounts); in mnt_add_to_ns()
1196 mnt_notify_add(mnt); in mnt_add_to_ns()
1202 static void commit_tree(struct mount *mnt) in commit_tree() argument
1204 struct mount *parent = mnt->mnt_parent; in commit_tree()
1209 BUG_ON(parent == mnt); in commit_tree()
1211 list_add_tail(&head, &mnt->mnt_list); in commit_tree()
1221 __attach_mnt(mnt, parent); in commit_tree()
1262 struct mount *mnt; in vfs_create_mount() local
1267 mnt = alloc_vfsmnt(fc->source ?: "none"); in vfs_create_mount()
1268 if (!mnt) in vfs_create_mount()
1272 mnt->mnt.mnt_flags = MNT_INTERNAL; in vfs_create_mount()
1275 mnt->mnt.mnt_sb = fc->root->d_sb; in vfs_create_mount()
1276 mnt->mnt.mnt_root = dget(fc->root); in vfs_create_mount()
1277 mnt->mnt_mountpoint = mnt->mnt.mnt_root; in vfs_create_mount()
1278 mnt->mnt_parent = mnt; in vfs_create_mount()
1281 list_add_tail(&mnt->mnt_instance, &mnt->mnt.mnt_sb->s_mounts); in vfs_create_mount()
1283 return &mnt->mnt; in vfs_create_mount()
1303 struct vfsmount *mnt; in vfs_kern_mount() local
1319 mnt = fc_mount(fc); in vfs_kern_mount()
1321 mnt = ERR_PTR(ret); in vfs_kern_mount()
1324 return mnt; in vfs_kern_mount()
1346 struct super_block *sb = old->mnt.mnt_sb; in clone_mnt()
1347 struct mount *mnt; in clone_mnt() local
1350 mnt = alloc_vfsmnt(old->mnt_devname); in clone_mnt()
1351 if (!mnt) in clone_mnt()
1355 mnt->mnt_group_id = 0; /* not a peer of original */ in clone_mnt()
1357 mnt->mnt_group_id = old->mnt_group_id; in clone_mnt()
1359 if ((flag & CL_MAKE_SHARED) && !mnt->mnt_group_id) { in clone_mnt()
1360 err = mnt_alloc_group_id(mnt); in clone_mnt()
1365 mnt->mnt.mnt_flags = old->mnt.mnt_flags; in clone_mnt()
1366 mnt->mnt.mnt_flags &= ~(MNT_WRITE_HOLD|MNT_MARKED|MNT_INTERNAL); in clone_mnt()
1369 mnt->mnt.mnt_idmap = mnt_idmap_get(mnt_idmap(&old->mnt)); in clone_mnt()
1371 mnt->mnt.mnt_sb = sb; in clone_mnt()
1372 mnt->mnt.mnt_root = dget(root); in clone_mnt()
1373 mnt->mnt_mountpoint = mnt->mnt.mnt_root; in clone_mnt()
1374 mnt->mnt_parent = mnt; in clone_mnt()
1376 list_add_tail(&mnt->mnt_instance, &sb->s_mounts); in clone_mnt()
1381 list_add(&mnt->mnt_slave, &old->mnt_slave_list); in clone_mnt()
1382 mnt->mnt_master = old; in clone_mnt()
1383 CLEAR_MNT_SHARED(mnt); in clone_mnt()
1386 list_add(&mnt->mnt_share, &old->mnt_share); in clone_mnt()
1388 list_add(&mnt->mnt_slave, &old->mnt_slave); in clone_mnt()
1389 mnt->mnt_master = old->mnt_master; in clone_mnt()
1391 CLEAR_MNT_SHARED(mnt); in clone_mnt()
1394 set_mnt_shared(mnt); in clone_mnt()
1400 list_add(&mnt->mnt_expire, &old->mnt_expire); in clone_mnt()
1403 return mnt; in clone_mnt()
1406 mnt_free_id(mnt); in clone_mnt()
1407 free_vfsmnt(mnt); in clone_mnt()
1411 static void cleanup_mnt(struct mount *mnt) in cleanup_mnt() argument
1422 WARN_ON(mnt_get_writers(mnt)); in cleanup_mnt()
1423 if (unlikely(mnt->mnt_pins.first)) in cleanup_mnt()
1424 mnt_pin_kill(mnt); in cleanup_mnt()
1425 hlist_for_each_entry_safe(m, p, &mnt->mnt_stuck_children, mnt_umount) { in cleanup_mnt()
1427 mntput(&m->mnt); in cleanup_mnt()
1429 fsnotify_vfsmount_delete(&mnt->mnt); in cleanup_mnt()
1430 dput(mnt->mnt.mnt_root); in cleanup_mnt()
1431 deactivate_super(mnt->mnt.mnt_sb); in cleanup_mnt()
1432 mnt_free_id(mnt); in cleanup_mnt()
1433 call_rcu(&mnt->mnt_rcu, delayed_free_vfsmnt); in cleanup_mnt()
1452 static void mntput_no_expire(struct mount *mnt) in mntput_no_expire() argument
1458 if (likely(READ_ONCE(mnt->mnt_ns))) { in mntput_no_expire()
1468 mnt_add_count(mnt, -1); in mntput_no_expire()
1478 mnt_add_count(mnt, -1); in mntput_no_expire()
1479 count = mnt_get_count(mnt); in mntput_no_expire()
1486 if (unlikely(mnt->mnt.mnt_flags & MNT_DOOMED)) { in mntput_no_expire()
1491 mnt->mnt.mnt_flags |= MNT_DOOMED; in mntput_no_expire()
1494 list_del(&mnt->mnt_instance); in mntput_no_expire()
1496 if (unlikely(!list_empty(&mnt->mnt_mounts))) { in mntput_no_expire()
1498 list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) { in mntput_no_expire()
1500 hlist_add_head(&p->mnt_umount, &mnt->mnt_stuck_children); in mntput_no_expire()
1506 if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))) { in mntput_no_expire()
1509 init_task_work(&mnt->mnt_rcu, __cleanup_mnt); in mntput_no_expire()
1510 if (!task_work_add(task, &mnt->mnt_rcu, TWA_RESUME)) in mntput_no_expire()
1513 if (llist_add(&mnt->mnt_llist, &delayed_mntput_list)) in mntput_no_expire()
1517 cleanup_mnt(mnt); in mntput_no_expire()
1520 void mntput(struct vfsmount *mnt) in mntput() argument
1522 if (mnt) { in mntput()
1523 struct mount *m = real_mount(mnt); in mntput()
1532 struct vfsmount *mntget(struct vfsmount *mnt) in mntget() argument
1534 if (mnt) in mntget()
1535 mnt_add_count(real_mount(mnt), 1); in mntget()
1536 return mnt; in mntget()
1545 void mnt_make_shortterm(struct vfsmount *mnt) in mnt_make_shortterm() argument
1547 if (mnt) in mnt_make_shortterm()
1548 real_mount(mnt)->mnt_ns = NULL; in mnt_make_shortterm()
1584 p = clone_mnt(real_mount(path->mnt), path->dentry, CL_PRIVATE); in mnt_clone_internal()
1587 p->mnt.mnt_flags |= MNT_INTERNAL; in mnt_clone_internal()
1588 return &p->mnt; in mnt_clone_internal()
1653 struct mount *next = NULL, *mnt = v; in m_next() local
1654 struct rb_node *node = rb_next(&mnt->mnt_node); in m_next()
1673 return p->show(m, &r->mnt); in m_show()
1695 struct mount *mnt = real_mount(m); in may_umount_tree() local
1703 for (p = mnt; p; p = next_mnt(p, mnt)) { in may_umount_tree()
1730 int may_umount(struct vfsmount *mnt) in may_umount() argument
1735 if (propagate_mount_busy(real_mount(mnt), 2)) in may_umount()
1748 fsnotify_mnt_attach(p->mnt_ns, &p->mnt); in mnt_notify()
1750 fsnotify_mnt_detach(p->prev_ns, &p->mnt); in mnt_notify()
1752 fsnotify_mnt_move(p->mnt_ns, &p->mnt); in mnt_notify()
1754 fsnotify_mnt_detach(p->prev_ns, &p->mnt); in mnt_notify()
1755 fsnotify_mnt_attach(p->mnt_ns, &p->mnt); in mnt_notify()
1820 mntput(&m->mnt); in namespace_unlock()
1837 static bool disconnect_mount(struct mount *mnt, enum umount_tree_flags how) in disconnect_mount() argument
1844 if (!mnt_has_parent(mnt)) in disconnect_mount()
1851 if (!(mnt->mnt_parent->mnt.mnt_flags & MNT_UMOUNT)) in disconnect_mount()
1859 if (IS_MNT_LOCKED(mnt)) in disconnect_mount()
1870 static void umount_tree(struct mount *mnt, enum umount_tree_flags how) in umount_tree() argument
1876 propagate_mount_unlock(mnt); in umount_tree()
1879 for (p = mnt; p; p = next_mnt(p, mnt)) { in umount_tree()
1880 p->mnt.mnt_flags |= MNT_UMOUNT; in umount_tree()
1909 p->mnt.mnt_flags |= MNT_SYNC_UMOUNT; in umount_tree()
1940 static void shrink_submounts(struct mount *mnt);
1965 static int do_umount(struct mount *mnt, int flags) in do_umount() argument
1967 struct super_block *sb = mnt->mnt.mnt_sb; in do_umount()
1970 retval = security_sb_umount(&mnt->mnt, flags); in do_umount()
1981 if (&mnt->mnt == current->fs->root.mnt || in do_umount()
1990 if (mnt_get_count(mnt) != 2) { in do_umount()
1996 if (!xchg(&mnt->mnt_expiry_mark, 1)) in do_umount()
2023 if (&mnt->mnt == current->fs->root.mnt && !(flags & MNT_DETACH)) { in do_umount()
2038 if (mnt->mnt.mnt_flags & MNT_LOCKED) in do_umount()
2043 if (mnt_ns_attached(mnt) || !list_empty(&mnt->mnt_list)) in do_umount()
2044 umount_tree(mnt, UMOUNT_PROPAGATE); in do_umount()
2048 shrink_submounts(mnt); in do_umount()
2050 if (!propagate_mount_busy(mnt, 2)) { in do_umount()
2051 if (mnt_ns_attached(mnt) || !list_empty(&mnt->mnt_list)) in do_umount()
2052 umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC); in do_umount()
2075 struct mount *mnt; in __detach_mounts() local
2085 mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list); in __detach_mounts()
2086 if (mnt->mnt.mnt_flags & MNT_UMOUNT) { in __detach_mounts()
2087 umount_mnt(mnt); in __detach_mounts()
2088 hlist_add_head(&mnt->mnt_umount, &unmounted); in __detach_mounts()
2090 else umount_tree(mnt, UMOUNT_CONNECTED); in __detach_mounts()
2117 struct mount *mnt = real_mount(path->mnt); in can_umount() local
2124 if (!check_mnt(mnt)) in can_umount()
2126 if (mnt->mnt.mnt_flags & MNT_LOCKED) /* Check optimistically */ in can_umount()
2136 struct mount *mnt = real_mount(path->mnt); in path_umount() local
2141 ret = do_umount(mnt, flags); in path_umount()
2145 mntput_no_expire(mnt); in path_umount()
2197 struct ns_common *from_mnt_ns(struct mnt_namespace *mnt) in from_mnt_ns() argument
2199 return &mnt->ns; in from_mnt_ns()
2286 if (src_mnt->mnt.mnt_flags & MNT_LOCKED) { in copy_tree()
2296 is_mnt_ns_file(src_mnt->mnt.mnt_root)) { in copy_tree()
2307 dst_mnt = clone_mnt(src_mnt, src_mnt->mnt.mnt_root, flag); in copy_tree()
2333 if (!check_mnt(real_mount(path->mnt))) in collect_mounts()
2336 tree = copy_tree(real_mount(path->mnt), path->dentry, in collect_mounts()
2341 return &tree->mnt; in collect_mounts()
2375 void dissolve_on_fput(struct vfsmount *mnt) in dissolve_on_fput() argument
2378 struct mount *m = real_mount(mnt); in dissolve_on_fput()
2418 void drop_collected_mounts(struct vfsmount *mnt) in drop_collected_mounts() argument
2422 umount_tree(real_mount(mnt), 0); in drop_collected_mounts()
2427 bool has_locked_children(struct mount *mnt, struct dentry *dentry) in has_locked_children() argument
2431 list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) { in has_locked_children()
2435 if (child->mnt.mnt_flags & MNT_LOCKED) in has_locked_children()
2454 if (mnt_ns_loop(p->mnt.mnt_root)) in check_for_nsfs_mounts()
2477 struct mount *old_mnt = real_mount(path->mnt); in clone_private_mount()
2489 if (!is_mounted(&old_mnt->mnt)) in clone_private_mount()
2510 return &new_mnt->mnt; in clone_private_mount()
2517 struct mount *mnt; in iterate_mounts() local
2521 list_for_each_entry(mnt, &real_mount(root)->mnt_list, mnt_list) { in iterate_mounts()
2522 res = f(&mnt->mnt, arg); in iterate_mounts()
2529 static void lock_mnt_tree(struct mount *mnt) in lock_mnt_tree() argument
2533 for (p = mnt; p; p = next_mnt(p, mnt)) { in lock_mnt_tree()
2534 int flags = p->mnt.mnt_flags; in lock_mnt_tree()
2552 p->mnt.mnt_flags = flags; in lock_mnt_tree()
2556 static void cleanup_group_ids(struct mount *mnt, struct mount *end) in cleanup_group_ids() argument
2560 for (p = mnt; p != end; p = next_mnt(p, mnt)) { in cleanup_group_ids()
2566 static int invent_group_ids(struct mount *mnt, bool recurse) in invent_group_ids() argument
2570 for (p = mnt; p; p = recurse ? next_mnt(p, mnt) : NULL) { in invent_group_ids()
2574 cleanup_group_ids(mnt, p); in invent_group_ids()
2583 int count_mounts(struct mnt_namespace *ns, struct mount *mnt) in count_mounts() argument
2596 for (p = mnt; p; p = next_mnt(p, mnt)) in count_mounts()
2697 smp = get_mountpoint(source_mnt->mnt.mnt_root); in attach_recursive_mnt()
2754 q = __lookup_mnt(&child->mnt_parent->mnt, in attach_recursive_mnt()
2761 child->mnt.mnt_flags &= ~MNT_LOCKED; in attach_recursive_mnt()
2823 struct vfsmount *mnt = path->mnt; in do_lock_mount() local
2829 struct mount *m = real_mount(mnt); in do_lock_mount()
2834 under.mnt = mntget(&m->mnt_parent->mnt); in do_lock_mount()
2845 if (unlikely(cant_mount(dentry) || !is_mounted(mnt))) in do_lock_mount()
2849 &m->mnt_parent->mnt != under.mnt)) { in do_lock_mount()
2855 mnt = lookup_mnt(path); in do_lock_mount()
2856 if (unlikely(mnt)) { in do_lock_mount()
2860 path->mnt = mnt; in do_lock_mount()
2861 path->dentry = dget(mnt->mnt_root); in do_lock_mount()
2899 static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) in graft_tree() argument
2901 if (mnt->mnt.mnt_sb->s_flags & SB_NOUSER) in graft_tree()
2905 d_is_dir(mnt->mnt.mnt_root)) in graft_tree()
2908 return attach_recursive_mnt(mnt, p, mp, 0); in graft_tree()
2934 struct mount *mnt = real_mount(path->mnt); in do_change_type() local
2948 err = invent_group_ids(mnt, recurse); in do_change_type()
2954 for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL)) in do_change_type()
3008 struct mount *mnt = real_mount(path->mnt); in may_copy_tree() local
3011 if (check_mnt(mnt)) in may_copy_tree()
3021 if (!is_mounted(path->mnt)) in may_copy_tree()
3024 return check_anonymous_mnt(mnt); in may_copy_tree()
3030 struct mount *mnt = ERR_PTR(-EINVAL), *old = real_mount(old_path->mnt); in __do_loopback() local
3033 return mnt; in __do_loopback()
3036 return mnt; in __do_loopback()
3039 return mnt; in __do_loopback()
3042 mnt = copy_tree(old, old_path->dentry, CL_COPY_MNT_NS_FILE); in __do_loopback()
3044 mnt = clone_mnt(old, old_path->dentry, 0); in __do_loopback()
3046 if (!IS_ERR(mnt)) in __do_loopback()
3047 mnt->mnt.mnt_flags &= ~MNT_LOCKED; in __do_loopback()
3049 return mnt; in __do_loopback()
3059 struct mount *mnt = NULL, *parent; in do_loopback() local
3078 parent = real_mount(path->mnt); in do_loopback()
3082 mnt = __do_loopback(&old_path, recurse); in do_loopback()
3083 if (IS_ERR(mnt)) { in do_loopback()
3084 err = PTR_ERR(mnt); in do_loopback()
3088 err = graft_tree(mnt, parent, mp); in do_loopback()
3091 umount_tree(mnt, UMOUNT_SYNC); in do_loopback()
3105 struct mount *mnt, *p; in open_detached_copy() local
3119 if (is_mounted(path->mnt)) { in open_detached_copy()
3120 src_mnt_ns = real_mount(path->mnt)->mnt_ns; in open_detached_copy()
3127 mnt = __do_loopback(path, recursive); in open_detached_copy()
3128 if (IS_ERR(mnt)) { in open_detached_copy()
3131 return ERR_CAST(mnt); in open_detached_copy()
3135 for (p = mnt; p; p = next_mnt(p, mnt)) { in open_detached_copy()
3139 ns->root = mnt; in open_detached_copy()
3140 mntget(&mnt->mnt); in open_detached_copy()
3144 mntput(path->mnt); in open_detached_copy()
3145 path->mnt = &mnt->mnt; in open_detached_copy()
3148 dissolve_on_fput(path->mnt); in open_detached_copy()
3214 static bool can_change_locked_flags(struct mount *mnt, unsigned int mnt_flags) in can_change_locked_flags() argument
3216 unsigned int fl = mnt->mnt.mnt_flags; in can_change_locked_flags()
3241 static int change_mount_ro_state(struct mount *mnt, unsigned int mnt_flags) in change_mount_ro_state() argument
3245 if (readonly_request == __mnt_is_readonly(&mnt->mnt)) in change_mount_ro_state()
3249 return mnt_make_readonly(mnt); in change_mount_ro_state()
3251 mnt->mnt.mnt_flags &= ~MNT_READONLY; in change_mount_ro_state()
3255 static void set_mount_attributes(struct mount *mnt, unsigned int mnt_flags) in set_mount_attributes() argument
3257 mnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK; in set_mount_attributes()
3258 mnt->mnt.mnt_flags = mnt_flags; in set_mount_attributes()
3259 touch_mnt_namespace(mnt->mnt_ns); in set_mount_attributes()
3262 static void mnt_warn_timestamp_expiry(struct path *mountpoint, struct vfsmount *mnt) in mnt_warn_timestamp_expiry() argument
3264 struct super_block *sb = mnt->mnt_sb; in mnt_warn_timestamp_expiry()
3266 if (!__mnt_is_readonly(mnt) && in mnt_warn_timestamp_expiry()
3281 is_mounted(mnt) ? "remounted" : "mounted", in mnt_warn_timestamp_expiry()
3298 struct super_block *sb = path->mnt->mnt_sb; in do_reconfigure_mnt()
3299 struct mount *mnt = real_mount(path->mnt); in do_reconfigure_mnt() local
3302 if (!check_mnt(mnt)) in do_reconfigure_mnt()
3308 if (!can_change_locked_flags(mnt, mnt_flags)) in do_reconfigure_mnt()
3317 ret = change_mount_ro_state(mnt, mnt_flags); in do_reconfigure_mnt()
3319 set_mount_attributes(mnt, mnt_flags); in do_reconfigure_mnt()
3323 mnt_warn_timestamp_expiry(path, &mnt->mnt); in do_reconfigure_mnt()
3337 struct super_block *sb = path->mnt->mnt_sb; in do_remount()
3338 struct mount *mnt = real_mount(path->mnt); in do_remount() local
3341 if (!check_mnt(mnt)) in do_remount()
3347 if (!can_change_locked_flags(mnt, mnt_flags)) in do_remount()
3368 set_mount_attributes(mnt, mnt_flags); in do_remount()
3375 mnt_warn_timestamp_expiry(path, &mnt->mnt); in do_remount()
3381 static inline int tree_contains_unbindable(struct mount *mnt) in tree_contains_unbindable() argument
3384 for (p = mnt; p; p = next_mnt(p, mnt)) { in tree_contains_unbindable()
3396 from = real_mount(from_path->mnt); in do_set_group()
3397 to = real_mount(to_path->mnt); in do_set_group()
3403 if (!is_mounted(&from->mnt)) in do_set_group()
3405 if (!is_mounted(&to->mnt)) in do_set_group()
3423 if (from->mnt.mnt_sb != to->mnt.mnt_sb) in do_set_group()
3427 if (!is_subdir(to->mnt.mnt_root, from->mnt.mnt_root)) in do_set_group()
3431 if (has_locked_children(from, to->mnt.mnt_root)) in do_set_group()
3476 if (unlikely(__lookup_mnt(path->mnt, path->dentry))) { in path_overmounted()
3509 struct mount *mnt_from = real_mount(from->mnt), in can_move_mount_beneath()
3510 *mnt_to = real_mount(to->mnt), in can_move_mount_beneath()
3530 if (&mnt_to->mnt == current->fs->root.mnt) in can_move_mount_beneath()
3599 static inline bool may_use_mount(struct mount *mnt) in may_use_mount() argument
3601 if (check_mnt(mnt)) in may_use_mount()
3609 if (!is_mounted(&mnt->mnt)) in may_use_mount()
3612 return check_anonymous_mnt(mnt); in may_use_mount()
3630 old = real_mount(old_path->mnt); in do_move_mount()
3631 p = real_mount(new_path->mnt); in do_move_mount()
3644 if (!is_mounted(&old->mnt)) in do_move_mount()
3677 if (old->mnt.mnt_flags & MNT_LOCKED) in do_move_mount()
3715 err = attach_recursive_mnt(old, real_mount(new_path->mnt), mp, flags); in do_move_mount()
3763 struct mount *parent = real_mount(path->mnt); in do_add_mount()
3777 if (path->mnt->mnt_sb == newmnt->mnt.mnt_sb && path_mounted(path)) in do_add_mount()
3780 if (d_is_symlink(newmnt->mnt.mnt_root)) in do_add_mount()
3783 newmnt->mnt.mnt_flags = mnt_flags; in do_add_mount()
3796 struct vfsmount *mnt; in do_new_mount_fc() local
3812 mnt = vfs_create_mount(fc); in do_new_mount_fc()
3813 if (IS_ERR(mnt)) in do_new_mount_fc()
3814 return PTR_ERR(mnt); in do_new_mount_fc()
3816 mnt_warn_timestamp_expiry(mountpoint, mnt); in do_new_mount_fc()
3820 mntput(mnt); in do_new_mount_fc()
3823 error = do_add_mount(real_mount(mnt), mp, mountpoint, mnt_flags); in do_new_mount_fc()
3826 mntput(mnt); in do_new_mount_fc()
3893 struct mount *mnt; in finish_automount() local
3901 mnt = real_mount(m); in finish_automount()
3905 BUG_ON(mnt_get_count(mnt) < 2); in finish_automount()
3907 if (m->mnt_sb == path->mnt->mnt_sb && in finish_automount()
3934 err = do_add_mount(mnt, mp, path, path->mnt->mnt_flags | MNT_SHRINKABLE); in finish_automount()
3946 if (!list_empty(&mnt->mnt_expire)) { in finish_automount()
3948 list_del_init(&mnt->mnt_expire); in finish_automount()
3961 void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list) in mnt_set_expiry() argument
3965 list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list); in mnt_set_expiry()
3978 struct mount *mnt, *next; in mark_mounts_for_expiry() local
3993 list_for_each_entry_safe(mnt, next, mounts, mnt_expire) { in mark_mounts_for_expiry()
3994 if (!xchg(&mnt->mnt_expiry_mark, 1) || in mark_mounts_for_expiry()
3995 propagate_mount_busy(mnt, 1)) in mark_mounts_for_expiry()
3997 list_move(&mnt->mnt_expire, &graveyard); in mark_mounts_for_expiry()
4000 mnt = list_first_entry(&graveyard, struct mount, mnt_expire); in mark_mounts_for_expiry()
4001 touch_mnt_namespace(mnt->mnt_ns); in mark_mounts_for_expiry()
4002 umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC); in mark_mounts_for_expiry()
4027 struct mount *mnt = list_entry(tmp, struct mount, mnt_child); in select_submounts() local
4030 if (!(mnt->mnt.mnt_flags & MNT_SHRINKABLE)) in select_submounts()
4035 if (!list_empty(&mnt->mnt_mounts)) { in select_submounts()
4036 this_parent = mnt; in select_submounts()
4040 if (!propagate_mount_busy(mnt, 1)) { in select_submounts()
4041 list_move_tail(&mnt->mnt_expire, graveyard); in select_submounts()
4062 static void shrink_submounts(struct mount *mnt) in shrink_submounts() argument
4068 while (select_submounts(mnt, &graveyard)) { in shrink_submounts()
4185 mnt_flags |= path->mnt->mnt_flags & MNT_ATIME_MASK; in path_mount()
4319 new = copy_tree(old, old->mnt.mnt_root, copy_flags); in copy_mnt_ns()
4345 if (&p->mnt == new_fs->root.mnt) { in copy_mnt_ns()
4346 new_fs->root.mnt = mntget(&q->mnt); in copy_mnt_ns()
4347 rootmnt = &p->mnt; in copy_mnt_ns()
4349 if (&p->mnt == new_fs->pwd.mnt) { in copy_mnt_ns()
4350 new_fs->pwd.mnt = mntget(&q->mnt); in copy_mnt_ns()
4351 pwdmnt = &p->mnt; in copy_mnt_ns()
4359 while (p->mnt.mnt_root != q->mnt.mnt_root) in copy_mnt_ns()
4375 struct mount *mnt = real_mount(m); in mount_subtree() local
4386 ns->root = mnt; in mount_subtree()
4388 mnt_add_to_ns(ns, mnt); in mount_subtree()
4399 s = path.mnt->mnt_sb; in mount_subtree()
4401 mntput(path.mnt); in mount_subtree()
4484 struct mount *mnt; in SYSCALL_DEFINE3() local
4543 newmount.mnt = vfs_create_mount(fc); in SYSCALL_DEFINE3()
4544 if (IS_ERR(newmount.mnt)) { in SYSCALL_DEFINE3()
4545 ret = PTR_ERR(newmount.mnt); in SYSCALL_DEFINE3()
4549 newmount.mnt->mnt_flags = mnt_flags; in SYSCALL_DEFINE3()
4563 mnt = real_mount(newmount.mnt); in SYSCALL_DEFINE3()
4564 ns->root = mnt; in SYSCALL_DEFINE3()
4566 mnt_add_to_ns(ns, mnt); in SYSCALL_DEFINE3()
4567 mntget(newmount.mnt); in SYSCALL_DEFINE3()
4574 dissolve_on_fput(newmount.mnt); in SYSCALL_DEFINE3()
4693 bool is_path_reachable(struct mount *mnt, struct dentry *dentry, in is_path_reachable() argument
4696 while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) { in is_path_reachable()
4697 dentry = mnt->mnt_mountpoint; in is_path_reachable()
4698 mnt = mnt->mnt_parent; in is_path_reachable()
4700 return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry); in is_path_reachable()
4707 res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2); in path_is_under()
4770 new_mnt = real_mount(new.mnt); in SYSCALL_DEFINE2()
4771 root_mnt = real_mount(root.mnt); in SYSCALL_DEFINE2()
4772 old_mnt = real_mount(old.mnt); in SYSCALL_DEFINE2()
4781 if (new_mnt->mnt.mnt_flags & MNT_LOCKED) in SYSCALL_DEFINE2()
4807 if (root_mnt->mnt.mnt_flags & MNT_LOCKED) { in SYSCALL_DEFINE2()
4808 new_mnt->mnt.mnt_flags |= MNT_LOCKED; in SYSCALL_DEFINE2()
4809 root_mnt->mnt.mnt_flags &= ~MNT_LOCKED; in SYSCALL_DEFINE2()
4839 static unsigned int recalc_flags(struct mount_kattr *kattr, struct mount *mnt) in recalc_flags() argument
4841 unsigned int flags = mnt->mnt.mnt_flags; in recalc_flags()
4851 static int can_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt) in can_idmap_mount() argument
4853 struct vfsmount *m = &mnt->mnt; in can_idmap_mount()
4886 if (!is_anon_ns(mnt->mnt_ns)) in can_idmap_mount()
4902 const struct mount *mnt) in mnt_allow_writers() argument
4905 (mnt->mnt.mnt_flags & MNT_READONLY)) && in mnt_allow_writers()
4909 static int mount_setattr_prepare(struct mount_kattr *kattr, struct mount *mnt) in mount_setattr_prepare() argument
4914 for (m = mnt; m; m = next_mnt(m, mnt)) { in mount_setattr_prepare()
4942 for (p = mnt; p; p = next_mnt(p, mnt)) { in mount_setattr_prepare()
4944 if (p->mnt.mnt_flags & MNT_WRITE_HOLD) in mount_setattr_prepare()
4958 static void do_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt) in do_idmap_mount() argument
4965 old_idmap = mnt_idmap(&mnt->mnt); in do_idmap_mount()
4968 smp_store_release(&mnt->mnt.mnt_idmap, mnt_idmap_get(kattr->mnt_idmap)); in do_idmap_mount()
4972 static void mount_setattr_commit(struct mount_kattr *kattr, struct mount *mnt) in mount_setattr_commit() argument
4976 for (m = mnt; m; m = next_mnt(m, mnt)) { in mount_setattr_commit()
4981 WRITE_ONCE(m->mnt.mnt_flags, flags); in mount_setattr_commit()
4984 if (m->mnt.mnt_flags & MNT_WRITE_HOLD) in mount_setattr_commit()
4992 touch_mnt_namespace(mnt->mnt_ns); in mount_setattr_commit()
4997 struct mount *mnt = real_mount(path->mnt); in do_mount_setattr() local
5019 err = invent_group_ids(mnt, kattr->kflags & MOUNT_KATTR_RECURSE); in do_mount_setattr()
5031 if (!is_mounted(&mnt->mnt)) in do_mount_setattr()
5045 if ((mnt_has_parent(mnt) || !is_anon_ns(mnt->mnt_ns)) && !check_mnt(mnt)) in do_mount_setattr()
5053 err = mount_setattr_prepare(kattr, mnt); in do_mount_setattr()
5055 mount_setattr_commit(kattr, mnt); in do_mount_setattr()
5062 cleanup_group_ids(mnt, NULL); in do_mount_setattr()
5323 struct mount *mnt = mnt_find_id_at(ns, id); in lookup_mnt_in_ns() local
5325 if (!mnt || mnt->mnt_id_unique != id) in lookup_mnt_in_ns()
5328 return &mnt->mnt; in lookup_mnt_in_ns()
5334 struct vfsmount *mnt; member
5344 static u64 mnt_to_attr_flags(struct vfsmount *mnt) in mnt_to_attr_flags() argument
5346 unsigned int mnt_flags = READ_ONCE(mnt->mnt_flags); in mnt_to_attr_flags()
5369 if (is_idmapped_mnt(mnt)) in mnt_to_attr_flags()
5393 struct super_block *sb = s->mnt->mnt_sb; in statmount_sb_basic()
5404 struct mount *m = real_mount(s->mnt); in statmount_mnt_basic()
5411 s->sm.mnt_attr = mnt_to_attr_flags(&m->mnt); in statmount_mnt_basic()
5419 struct mount *m = real_mount(s->mnt); in statmount_propagate_from()
5431 ret = show_path(seq, s->mnt->mnt_root); in statmount_mnt_root()
5450 struct vfsmount *mnt = s->mnt; in statmount_mnt_point() local
5451 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; in statmount_mnt_point()
5460 struct super_block *sb = s->mnt->mnt_sb; in statmount_fs_type()
5468 struct super_block *sb = s->mnt->mnt_sb; in statmount_fs_subtype()
5476 struct super_block *sb = s->mnt->mnt_sb; in statmount_sb_source()
5477 struct mount *r = real_mount(s->mnt); in statmount_sb_source()
5483 ret = sb->s_op->show_devname(seq, s->mnt->mnt_root); in statmount_sb_source()
5508 struct vfsmount *mnt = s->mnt; in statmount_mnt_opts() local
5509 struct super_block *sb = mnt->mnt_sb; in statmount_mnt_opts()
5518 err = sb->s_op->show_options(seq, mnt->mnt_root); in statmount_mnt_opts()
5568 struct vfsmount *mnt = s->mnt; in statmount_opt_array() local
5569 struct super_block *sb = mnt->mnt_sb; in statmount_opt_array()
5576 err = sb->s_op->show_options(seq, mnt->mnt_root); in statmount_opt_array()
5590 struct vfsmount *mnt = s->mnt; in statmount_opt_sec_array() local
5591 struct super_block *sb = mnt->mnt_sb; in statmount_opt_sec_array()
5789 root->mnt = mntget(&child->mnt); in grab_requested_root()
5790 root->dentry = dget(root->mnt->mnt_root); in grab_requested_root()
5820 s->mnt = lookup_mnt_in_ns(mnt_id, ns); in do_statmount()
5821 if (!s->mnt) in do_statmount()
5832 m = real_mount(s->mnt); in do_statmount()
5833 if (!is_path_reachable(m, m->mnt.mnt_root, &root) && in do_statmount()
5837 err = security_sb_statfs(s->mnt->mnt_root); in do_statmount()
5842 s->idmap = mnt_idmap(s->mnt); in do_statmount()
6071 orig.mnt = lookup_mnt_in_ns(mnt_parent_id, ns); in do_listmount()
6072 if (!orig.mnt) in do_listmount()
6074 orig.dentry = orig.mnt->mnt_root; in do_listmount()
6081 if (!is_path_reachable(real_mount(orig.mnt), orig.dentry, &root) && in do_listmount()
6104 if (!is_path_reachable(r, r->mnt.mnt_root, &orig)) in do_listmount()
6174 struct vfsmount *mnt; in init_mount_tree() local
6179 mnt = vfs_kern_mount(&rootfs_fs_type, 0, "rootfs", NULL); in init_mount_tree()
6180 if (IS_ERR(mnt)) in init_mount_tree()
6186 m = real_mount(mnt); in init_mount_tree()
6193 root.mnt = mnt; in init_mount_tree()
6194 root.dentry = mnt->mnt_root; in init_mount_tree()
6195 mnt->mnt_flags |= MNT_LOCKED; in init_mount_tree()
6242 drop_collected_mounts(&ns->root->mnt); in put_mnt_ns()
6248 struct vfsmount *mnt; in kern_mount() local
6249 mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL); in kern_mount()
6250 if (!IS_ERR(mnt)) { in kern_mount()
6255 real_mount(mnt)->mnt_ns = MNT_NS_INTERNAL; in kern_mount()
6257 return mnt; in kern_mount()
6261 void kern_unmount(struct vfsmount *mnt) in kern_unmount() argument
6264 if (!IS_ERR(mnt)) { in kern_unmount()
6265 mnt_make_shortterm(mnt); in kern_unmount()
6267 mntput(mnt); in kern_unmount()
6272 void kern_unmount_array(struct vfsmount *mnt[], unsigned int num) in kern_unmount_array() argument
6277 mnt_make_shortterm(mnt[i]); in kern_unmount_array()
6280 mntput(mnt[i]); in kern_unmount_array()
6284 bool our_mnt(struct vfsmount *mnt) in our_mnt() argument
6286 return check_mnt(real_mount(mnt)); in our_mnt()
6297 ns_root.mnt = ¤t->nsproxy->mnt_ns->root->mnt; in current_chrooted()
6298 ns_root.dentry = ns_root.mnt->mnt_root; in current_chrooted()
6318 struct mount *mnt, *n; in mnt_already_visible() local
6322 rbtree_postorder_for_each_entry_safe(mnt, n, &ns->mounts, mnt_node) { in mnt_already_visible()
6326 if (mnt->mnt.mnt_sb->s_type != sb->s_type) in mnt_already_visible()
6332 if (mnt->mnt.mnt_root != mnt->mnt.mnt_sb->s_root) in mnt_already_visible()
6336 mnt_flags = mnt->mnt.mnt_flags; in mnt_already_visible()
6339 if (sb_rdonly(mnt->mnt.mnt_sb)) in mnt_already_visible()
6356 list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) { in mnt_already_visible()
6359 if (!(child->mnt.mnt_flags & MNT_LOCKED)) in mnt_already_visible()
6400 bool mnt_may_suid(struct vfsmount *mnt) in mnt_may_suid() argument
6409 return !(mnt->mnt_flags & MNT_NOSUID) && check_mnt(real_mount(mnt)) && in mnt_may_suid()
6410 current_in_userns(mnt->mnt_sb->s_user_ns); in mnt_may_suid()
6459 err = vfs_path_lookup(mnt_ns->root->mnt.mnt_root, &mnt_ns->root->mnt, in mntns_install()