Lines Matching full:mount
31 #include <uapi/linux/mount.h>
40 /* Maximum number of mounts in a mount namespace */
72 /* Don't allow confusion with old 32bit mount ID */
172 /* keep alive for {list,stat}mount() */ in mnt_ns_release()
188 /* remove from global mount namespace list */ in mnt_ns_tree_remove()
212 * Lookup a mount namespace by id and take a passive reference count. Taking a
213 * passive reference means the mount namespace can be emptied if e.g., the last
216 * already shut down before acquiring @namespace_sem, {list,stat}mount() will
217 * see that the mount rbtree of the namespace is empty.
221 * possible. So if we didn't find a mount namespace and the sequence
276 static int mnt_alloc_id(struct mount *mnt) in mnt_alloc_id()
288 static void mnt_free_id(struct mount *mnt) in mnt_free_id()
296 static int mnt_alloc_group_id(struct mount *mnt) in mnt_alloc_group_id()
309 void mnt_release_group_id(struct mount *mnt) in mnt_release_group_id()
318 static inline void mnt_add_count(struct mount *mnt, int n) in mnt_add_count()
332 int mnt_get_count(struct mount *mnt) in mnt_get_count()
348 static struct mount *alloc_vfsmnt(const char *name) in alloc_vfsmnt()
350 struct mount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL); in alloc_vfsmnt()
412 * __mnt_is_readonly: check whether a mount is read-only
413 * @mnt: the mount to check for its write status
428 static inline void mnt_inc_writers(struct mount *mnt) in mnt_inc_writers()
437 static inline void mnt_dec_writers(struct mount *mnt) in mnt_dec_writers()
446 static unsigned int mnt_get_writers(struct mount *mnt) in mnt_get_writers()
469 * not see any superblock / mount flag changes done by remount. in mnt_is_readonly()
472 * see the values of superblock / mount flags updated by remount. in mnt_is_readonly()
485 * mnt_get_write_access - get write access to a mount without freeze protection
486 * @m: the mount on which to take a write
496 struct mount *mnt = real_mount(m); in mnt_get_write_access()
544 * mnt_want_write - get write access to a mount
545 * @m: the mount on which to take a write
548 * it, and makes sure that writes are allowed (mount is read-write, filesystem
565 * mnt_get_write_access_file - get write access to a file's mount
566 * @file: the file who's mount on which to take a write
588 * mnt_want_write_file - get write access to a file's mount
589 * @file: the file who's mount on which to take a write
609 * mnt_put_write_access - give up write access to a mount
610 * @mnt: the mount on which to give up write access
625 * mnt_drop_write - give up write access to a mount
626 * @mnt: the mount on which to give up write access
653 * mnt_hold_writers - prevent write access to the given mount
670 static inline int mnt_hold_writers(struct mount *mnt) in mnt_hold_writers()
702 * mnt_unhold_writers - stop preventing write access to the given mount
713 static inline void mnt_unhold_writers(struct mount *mnt) in mnt_unhold_writers()
723 static int mnt_make_readonly(struct mount *mnt) in mnt_make_readonly()
736 struct mount *mnt; in sb_prepare_remount_readonly()
765 static void free_vfsmnt(struct mount *mnt) in free_vfsmnt()
777 free_vfsmnt(container_of(head, struct mount, mnt_rcu)); in delayed_free_vfsmnt()
783 struct mount *mnt; in __legitimize_mnt()
819 * __lookup_mnt - find first child mount
820 * @mnt: parent mount
823 * If @mnt has a child mount @c mounted @dentry find and return it.
825 * Note that the child mount @c need not be unique. There are cases
826 * where shadow mounts are created. For example, during mount
827 * propagation when a source mount @mnt whose root got overmounted by a
828 * mount @o after path lookup but before @namespace_sem could be
830 * @o. When @mnt is propagated to a destination mount @d that already
831 * has another mount @n mounted at the same mountpoint then the source
832 * mount @mnt will be tucked beneath @n, i.e., @n will be mounted on
838 struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry) in __lookup_mnt()
841 struct mount *p; in __lookup_mnt()
850 * lookup_mnt - Return the first child mount mounted at path
855 * mount /dev/sda1 /mnt
856 * mount /dev/sda2 /mnt
857 * mount /dev/sda3 /mnt
859 * Then lookup_mnt() on the base /mnt dentry in the root mount will
867 struct mount *child_mnt; in lookup_mnt()
883 * current mount namespace.
888 * mounts in the current mount namespace and test to see if the dentry
892 * need to identify all mounts that may be in the current mount
893 * namespace not just a mount that happens to have some specified
894 * parent mount.
899 struct mount *mnt, *n; in __is_local_mountpoint()
1001 static inline int check_mnt(struct mount *mnt) in check_mnt()
1006 static inline bool check_anonymous_mnt(struct mount *mnt) in check_anonymous_mnt()
1042 static struct mountpoint *unhash_mnt(struct mount *mnt) in unhash_mnt()
1058 static void umount_mnt(struct mount *mnt) in umount_mnt()
1066 void mnt_set_mountpoint(struct mount *mnt, in mnt_set_mountpoint()
1068 struct mount *child_mnt) in mnt_set_mountpoint()
1079 * mnt_set_mountpoint_beneath - mount a mount beneath another one
1081 * @new_parent: the source mount
1082 * @top_mnt: the mount beneath which @new_parent is mounted
1086 * parent @top_mnt->mnt_parent and mount it on top of @new_parent at
1087 * @new_mp. And mount @new_parent on the old parent and old
1093 static void mnt_set_mountpoint_beneath(struct mount *new_parent, in mnt_set_mountpoint_beneath()
1094 struct mount *top_mnt, in mnt_set_mountpoint_beneath()
1097 struct mount *old_top_parent = top_mnt->mnt_parent; in mnt_set_mountpoint_beneath()
1105 static void __attach_mnt(struct mount *mnt, struct mount *parent) in __attach_mnt()
1113 * attach_mnt - mount a mount, attach to @mount_hashtable and parent's
1116 * @mnt: the new mount
1118 * @beneath: whether to mount @mnt beneath or on top of @parent
1120 * If @beneath is false, mount @mnt at @mp on @parent. Then attach @mnt
1121 * to @parent's child mount list and to @mount_hashtable.
1124 * mountpoint and mount it on @mp on @parent, and mount @parent on the
1134 static void attach_mnt(struct mount *mnt, struct mount *parent, in attach_mnt()
1145 * isn't the same mount as @parent. in attach_mnt()
1150 void mnt_change_mountpoint(struct mount *parent, struct mountpoint *mp, struct mount *mnt) in mnt_change_mountpoint()
1153 struct mount *old_parent = mnt->mnt_parent; in mnt_change_mountpoint()
1165 static inline struct mount *node_to_mount(struct rb_node *node) in node_to_mount()
1167 return node ? rb_entry(node, struct mount, mnt_node) : NULL; in node_to_mount()
1170 static void mnt_add_to_ns(struct mnt_namespace *ns, struct mount *mnt) in mnt_add_to_ns()
1202 static void commit_tree(struct mount *mnt) in commit_tree()
1204 struct mount *parent = mnt->mnt_parent; in commit_tree()
1205 struct mount *m; in commit_tree()
1225 static struct mount *next_mnt(struct mount *p, struct mount *root) in next_mnt()
1238 return list_entry(next, struct mount, mnt_child); in next_mnt()
1241 static struct mount *skip_mnt_tree(struct mount *p) in skip_mnt_tree()
1245 p = list_entry(prev, struct mount, mnt_child); in skip_mnt_tree()
1252 * vfs_create_mount - Create a mount for a configured superblock
1255 * Create a mount to an already configured superblock. If necessary, the
1258 * Note that this does not attach the mount to anything.
1262 struct mount *mnt; in vfs_create_mount()
1333 * through from the parent mount to the submount don't support in vfs_submount()
1343 static struct mount *clone_mnt(struct mount *old, struct dentry *root, in clone_mnt()
1347 struct mount *mnt; in clone_mnt()
1396 /* stick the duplicate mount on the same expiry list in clone_mnt()
1411 static void cleanup_mnt(struct mount *mnt) in cleanup_mnt()
1414 struct mount *m; in cleanup_mnt()
1438 cleanup_mnt(container_of(head, struct mount, mnt_rcu)); in __cleanup_mnt()
1445 struct mount *m, *t; in delayed_mntput()
1452 static void mntput_no_expire(struct mount *mnt) in mntput_no_expire()
1497 struct mount *p, *tmp; in mntput_no_expire()
1523 struct mount *m = real_mount(mnt); in mntput()
1541 * Make a mount point inaccessible to new lookups.
1543 * for an RCU grace period before destroying the mount point.
1552 * path_is_mountpoint() - Check if path is a mount in the current namespace.
1583 struct mount *p; in mnt_clone_internal()
1592 * Returns the mount which either has the specified mnt_id, or has the next
1595 static struct mount *mnt_find_id_at(struct mnt_namespace *ns, u64 mnt_id) in mnt_find_id_at()
1598 struct mount *ret = NULL; in mnt_find_id_at()
1601 struct mount *m = node_to_mount(node); in mnt_find_id_at()
1616 * Returns the mount which either has the specified mnt_id, or has the next
1619 static struct mount *mnt_find_id_at_reverse(struct mnt_namespace *ns, u64 mnt_id) in mnt_find_id_at_reverse()
1622 struct mount *ret = NULL; in mnt_find_id_at_reverse()
1625 struct mount *m = node_to_mount(node); in mnt_find_id_at_reverse()
1653 struct mount *next = NULL, *mnt = v; in m_next()
1672 struct mount *r = v; in m_show()
1686 * may_umount_tree - check if a mount tree is busy
1687 * @m: root of mount tree
1695 struct mount *mnt = real_mount(m); in may_umount_tree()
1698 struct mount *p; in may_umount_tree()
1718 * may_umount - check if a mount point is busy
1719 * @mnt: root of mount
1721 * This is called to check if a mount point has any
1723 * mount has sub mounts this will return busy
1745 static void mnt_notify(struct mount *p) in mnt_notify()
1762 struct mount *m, *tmp; in notify_mnt_list()
1792 struct mount *m; in namespace_unlock()
1837 static bool disconnect_mount(struct mount *mnt, enum umount_tree_flags how) in disconnect_mount()
1843 /* A mount without a parent has nothing to be connected to */ in disconnect_mount()
1854 /* Has it been requested that the mount remain connected? */ in disconnect_mount()
1858 /* Is the mount locked such that it needs to remain connected? */ in disconnect_mount()
1862 /* By default disconnect the mount */ in disconnect_mount()
1870 static void umount_tree(struct mount *mnt, enum umount_tree_flags how) in umount_tree()
1873 struct mount *p; in umount_tree()
1899 p = list_first_entry(&tmp_list, struct mount, mnt_list); in umount_tree()
1932 * This will preclude queuing the mount if this is a cleanup in umount_tree()
1940 static void shrink_submounts(struct mount *mnt);
1965 static int do_umount(struct mount *mnt, int flags) in do_umount()
2002 * mount, and they will themselves hold resources we must in do_umount()
2006 * must return, and the like. Thats for the mount program to worry in do_umount()
2066 * to an existing mountpoint, and wind up leaking the mount.
2075 struct mount *mnt; in __detach_mounts()
2085 mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list); in __detach_mounts()
2109 "WARNING: The mand mount option has been deprecated and\n" in warn_mandlock()
2111 " option from the mount to silence this warning.\n" in warn_mandlock()
2117 struct mount *mnt = real_mount(path->mnt); in can_umount()
2136 struct mount *mnt = real_mount(path->mnt); in path_umount()
2188 /* Is this a proxy for a mount namespace? */ in is_mnt_ns_file()
2220 * delay so accessing the mount namespace is not just in get_sequential_mnt_ns()
2228 * the mount namespace and it might already be on its in get_sequential_mnt_ns()
2248 /* Could bind mounting the mount namespace inode cause a in mnt_ns_loop()
2249 * mount namespace loop? in mnt_ns_loop()
2259 struct mount *copy_tree(struct mount *src_root, struct dentry *dentry, in copy_tree()
2262 struct mount *res, *src_parent, *src_root_child, *src_mnt, in copy_tree()
2331 struct mount *tree; in collect_mounts()
2350 * This mount belonged to an anonymous mount namespace in must_dissolve()
2351 * but was moved to a non-anonymous mount namespace and in must_dissolve()
2358 * This mount belongs to a non-anonymous mount namespace in must_dissolve()
2359 * and we know that such a mount can never transition to in must_dissolve()
2360 * an anonymous mount namespace again. in must_dissolve()
2364 * A detached mount either belongs to an anonymous mount in must_dissolve()
2365 * namespace or a non-anonymous mount namespace. It in must_dissolve()
2378 struct mount *m = real_mount(mnt); in dissolve_on_fput()
2392 * mount in an anonymous mount namespace. in dissolve_on_fput()
2394 * Now when mnt_has_parent() reports that this mount in dissolve_on_fput()
2395 * tree has a parent, we know that this anonymous mount in dissolve_on_fput()
2396 * tree has been moved to another anonymous mount in dissolve_on_fput()
2399 * So when closing this file we cannot unmount the mount in dissolve_on_fput()
2401 * the root of the anonymous mount namespace will be in dissolve_on_fput()
2427 bool has_locked_children(struct mount *mnt, struct dentry *dentry) in has_locked_children()
2429 struct mount *child; in has_locked_children()
2442 * Check that there aren't references to earlier/same mount namespaces in the
2443 * specified subtree. Such references can act as pins for mount namespaces
2444 * that aren't checked by the mount-cycle checking code, thereby allowing
2447 static bool check_for_nsfs_mounts(struct mount *subtree) in check_for_nsfs_mounts()
2449 struct mount *p; in check_for_nsfs_mounts()
2467 * This creates a new vfsmount, which will be the clone of @path. The new mount
2469 * changes to the originating mount won't be propagated into this).
2477 struct mount *old_mnt = real_mount(path->mnt); in clone_private_mount()
2478 struct mount *new_mnt; in clone_private_mount()
2496 /* Make sure we don't create mount namespace loops. */ in clone_private_mount()
2508 /* Longterm mount to be removed by kern_unmount*() */ in clone_private_mount()
2517 struct mount *mnt; in iterate_mounts()
2529 static void lock_mnt_tree(struct mount *mnt) in lock_mnt_tree()
2531 struct mount *p; in lock_mnt_tree()
2535 /* Don't allow unprivileged users to change mount flags */ in lock_mnt_tree()
2549 /* Don't allow unprivileged users to reveal what is under a mount */ in lock_mnt_tree()
2556 static void cleanup_group_ids(struct mount *mnt, struct mount *end) in cleanup_group_ids()
2558 struct mount *p; in cleanup_group_ids()
2566 static int invent_group_ids(struct mount *mnt, bool recurse) in invent_group_ids()
2568 struct mount *p; in invent_group_ids()
2583 int count_mounts(struct mnt_namespace *ns, struct mount *mnt) in count_mounts()
2587 struct mount *p; in count_mounts()
2613 * attach_recursive_mnt - attach a source mount tree
2614 * @source_mnt: mount tree to be attached
2615 * @top_mnt: mount that @source_mnt will be mounted on or mounted beneath
2619 * NOTE: in the table below explains the semantics when a source mount
2620 * of a given type is attached to a destination mount of a given type.
2622 * | BIND MOUNT OPERATION |
2633 * A bind operation clones the source mount and mounts the clone on the
2634 * destination mount.
2636 * (++) the cloned mount is propagated to all the mounts in the propagation
2637 * tree of the destination mount and the cloned mount is added to
2638 * the peer group of the source mount.
2639 * (+) the cloned mount is created under the destination mount and is marked
2640 * as shared. The cloned mount is added to the peer group of the source
2641 * mount.
2642 * (+++) the mount is propagated to all the mounts in the propagation tree
2643 * of the destination mount and the cloned mount is made slave
2644 * of the same master as that of the source mount. The cloned mount
2646 * (*) the cloned mount is made a slave of the same master as that of the
2647 * source mount.
2650 * | MOVE MOUNT OPERATION |
2662 * (+) the mount is moved to the destination. And is then propagated to
2663 * all the mounts in the propagation tree of the destination mount.
2664 * (+*) the mount is moved to the destination.
2665 * (+++) the mount is moved to the destination and is then propagated to
2666 * all the mounts belonging to the destination mount's propagation tree.
2667 * the mount is marked as 'shared and slave'.
2668 * (*) the mount continues to be a slave at the new location.
2670 * if the source mount is a tree, the operations explained above is
2671 * applied to each mount in the tree.
2679 static int attach_recursive_mnt(struct mount *source_mnt, in attach_recursive_mnt()
2680 struct mount *top_mnt, in attach_recursive_mnt()
2688 struct mount *child, *dest_mnt, *p; in attach_recursive_mnt()
2701 /* Is there space to add these mounts to the mount namespace? */ in attach_recursive_mnt()
2752 struct mount *q; in attach_recursive_mnt()
2771 child = hlist_entry(tree_list.first, struct mount, mnt_hash); in attach_recursive_mnt()
2788 * do_lock_mount - lock mount and mountpoint
2790 * @beneath: whether the intention is to mount beneath @path
2792 * Follow the mount stack on @path until the top mount @mnt is found. If
2794 * mount stacked on top of it. Then simply follow @{mnt,mnt->mnt_root}
2797 * Acquire the inode_lock() on the top mount's ->mnt_root to protect
2798 * against concurrent removal of the new mountpoint from another mount
2803 * concurrent unlink of @mp->mnt_dentry from another mount namespace
2804 * where @mnt doesn't have a child mount mounted @mp. A concurrent
2818 * Return: Either the target mountpoint on the top mount or the top
2819 * mount's mountpoint.
2829 struct mount *m = real_mount(mnt); in do_lock_mount()
2899 static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) in graft_tree()
2933 struct mount *m; in do_change_type()
2934 struct mount *mnt = real_mount(path->mnt); in do_change_type()
2963 /* may_copy_tree() - check if a mount tree can be copied
2964 * @path: path to the mount tree to be copied
2966 * This helper checks if the caller may copy the mount tree starting
2967 * from @path->mnt. The caller may copy the mount tree under the
2970 * (1) The caller is located in the mount namespace of the mount tree.
2971 * This also implies that the mount does not belong to an anonymous
2972 * mount namespace.
2973 * (2) The caller tries to copy an nfs mount referring to a mount
2974 * namespace, i.e., the caller is trying to copy a mount namespace
2976 * (3) The caller tries to copy a pidfs mount referring to a pidfd.
2977 * (4) The caller is trying to copy a mount tree that belongs to an
2978 * anonymous mount namespace.
2980 * For that to be safe, this helper enforces that the origin mount
2981 * namespace the anonymous mount namespace was created from is the
2982 * same as the caller's mount namespace by comparing the sequence
2986 * mount api enforce that the caller must be located in the same
2987 * mount namespace as the mount tree it interacts with. Using the
2989 * anonymous mount namespaces. However, one could envision extending
2990 * the api to directly operate across mount namespace if needed.
2992 * The ownership of a non-anonymous mount namespace such as the
2994 * => We know that the caller's mount namespace is stable.
2996 * If the origin sequence number of the anonymous mount namespace is
2997 * the same as the sequence number of the caller's mount namespace.
3001 * caller's mount namespace ensures that the caller has the
3002 * ability to copy the mount tree.
3004 * Returns true if the mount tree can be copied, false otherwise.
3008 struct mount *mnt = real_mount(path->mnt); in may_copy_tree()
3028 static struct mount *__do_loopback(struct path *old_path, int recurse) in __do_loopback()
3030 struct mount *mnt = ERR_PTR(-EINVAL), *old = real_mount(old_path->mnt); in __do_loopback()
3053 * do loopback mount.
3059 struct mount *mnt = NULL, *parent; in do_loopback()
3105 struct mount *mnt, *p; in open_detached_copy()
3115 * Record the sequence number of the source mount namespace. in open_detached_copy()
3116 * This needs to hold namespace_sem to ensure that the mount in open_detached_copy()
3209 * Don't allow locked mount flags to be cleared.
3214 static bool can_change_locked_flags(struct mount *mnt, unsigned int 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()
3255 static void set_mount_attributes(struct mount *mnt, unsigned int mnt_flags) in set_mount_attributes()
3294 * to mount(2).
3299 struct mount *mnt = real_mount(path->mnt); in do_reconfigure_mnt()
3338 struct mount *mnt = real_mount(path->mnt); in do_remount()
3356 * from the legacy mount system call. in do_remount()
3381 static inline int tree_contains_unbindable(struct mount *mnt) in tree_contains_unbindable()
3383 struct mount *p; in tree_contains_unbindable()
3393 struct mount *from, *to; in do_set_group()
3409 /* We should be allowed to modify mount namespaces of both mounts */ in do_set_group()
3416 /* To and From paths should be mount roots */ in do_set_group()
3426 /* From mount root should be wider than To mount root */ in do_set_group()
3430 /* From mount should not have locked children in place of To's root */ in do_set_group()
3443 struct mount *m = from->mnt_master; in do_set_group()
3467 * Check if path is overmounted, i.e., if there's a mount on top of
3485 * can_move_mount_beneath - check that we can mount beneath the top mount
3486 * @from: mount to mount beneath
3487 * @to: mount under which to mount
3490 * - Make sure that @to->dentry is actually the root of a mount under
3491 * which we can mount another mount.
3494 * - Make sure that the caller can unmount the topmost mount ensuring
3498 * - Prevent mounting beneath a mount if the propagation relationship
3499 * between the source mount, parent mount, and top mount would lead to
3500 * nonsensical mount trees.
3509 struct mount *mnt_from = real_mount(from->mnt), in can_move_mount_beneath()
3522 /* Avoid creating shadow mounts during mount propagation. */ in can_move_mount_beneath()
3535 for (struct mount *p = mnt_from; mnt_has_parent(p); p = p->mnt_parent) in can_move_mount_beneath()
3540 * If the parent mount propagates to the child mount this would in can_move_mount_beneath()
3543 * defeats the whole purpose of mounting beneath another mount. in can_move_mount_beneath()
3567 /* may_use_mount() - check if a mount tree can be used
3570 * This helper checks if the caller may use the mount tree starting
3571 * from @path->mnt. The caller may use the mount tree under the
3574 * (1) The caller is located in the mount namespace of the mount tree.
3575 * This also implies that the mount does not belong to an anonymous
3576 * mount namespace.
3577 * (2) The caller is trying to use a mount tree that belongs to an
3578 * anonymous mount namespace.
3580 * For that to be safe, this helper enforces that the origin mount
3581 * namespace the anonymous mount namespace was created from is the
3582 * same as the caller's mount namespace by comparing the sequence
3585 * The ownership of a non-anonymous mount namespace such as the
3587 * => We know that the caller's mount namespace is stable.
3589 * If the origin sequence number of the anonymous mount namespace is
3590 * the same as the sequence number of the caller's mount namespace.
3594 * caller's mount namespace ensures that the caller has the
3595 * ability to use the mount tree.
3597 * Returns true if the mount tree can be used, false otherwise.
3599 static inline bool may_use_mount(struct mount *mnt) in may_use_mount()
3619 struct mount *p; in do_move_mount()
3620 struct mount *old; in do_move_mount()
3621 struct mount *parent; in do_move_mount()
3654 * same anonymous mount namespace would cause an error in do_move_mount()
3655 * as this would mean trying to move the same mount in do_move_mount()
3656 * twice into the mount tree which would be rejected in do_move_mount()
3663 * If this is an anonymous mount tree ensure that mount in do_move_mount()
3665 * propagated to the target mount tree so we don't in do_move_mount()
3671 * Don't allow moving an attached mount tree to an in do_move_mount()
3672 * anonymous mount tree. in do_move_mount()
3687 * Don't move a mount residing in a shared parent. in do_move_mount()
3703 * Don't move a mount tree containing unbindable mounts to a destination in do_move_mount()
3704 * mount which is shared. in do_move_mount()
3719 /* if the mount is moved, it should no longer be expire in do_move_mount()
3758 * add a mount into a namespace's mount tree
3760 static int do_add_mount(struct mount *newmnt, struct mountpoint *mp, in do_add_mount()
3763 struct mount *parent = real_mount(path->mnt); in do_add_mount()
3776 /* Refuse the same filesystem on the same mount point */ in do_add_mount()
3790 * Create a new mount using a superblock configuration and request it
3831 * create a new mount for userspace and request it to be added into the
3866 * Indicate to the filesystem that the mount request is coming in do_new_mount()
3867 * from the legacy mount system call. in do_new_mount()
3893 struct mount *mnt; in finish_automount()
3902 /* The new mount record should have at least 2 refs to prevent it being in finish_automount()
3916 * got", not "try to mount it on top". in finish_automount()
3957 * mnt_set_expiry - Put a mount on an expiration list
3958 * @mnt: The mount to list.
3959 * @expiry_list: The list to add the mount to.
3978 struct mount *mnt, *next; in mark_mounts_for_expiry()
4000 mnt = list_first_entry(&graveyard, struct mount, mnt_expire); in mark_mounts_for_expiry()
4016 static int select_submounts(struct mount *parent, struct list_head *graveyard) in select_submounts()
4018 struct mount *this_parent = parent; in select_submounts()
4027 struct mount *mnt = list_entry(tmp, struct mount, mnt_child); in select_submounts()
4062 static void shrink_submounts(struct mount *mnt) in shrink_submounts()
4065 struct mount *m; in shrink_submounts()
4070 m = list_first_entry(&graveyard, struct mount, in shrink_submounts()
4121 * be given to the mount() call (ie: read-only, no-dev, no-suid etc).
4127 * Pre-0.97 versions of mount() didn't have a flags word.
4246 * mount a reference to an older mount namespace into the current
4247 * mount namespace, preventing reference counting loops. A 64bit
4296 struct mount *p, *q; in copy_mnt_ns()
4297 struct mount *old; in copy_mnt_ns()
4298 struct mount *new; in copy_mnt_ns()
4375 struct mount *mnt = real_mount(m); in mount_subtree()
4409 SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, in SYSCALL_DEFINE5() argument
4474 * Create a kernel mount representation for a new, prepared superblock
4484 struct mount *mnt; in SYSCALL_DEFINE3()
4525 /* There must be a valid superblock or we can't mount it */ in SYSCALL_DEFINE3()
4532 pr_warn("VFS: Mount too revealing\n"); in SYSCALL_DEFINE3()
4551 /* We've done the mount bit - now move the file context into more or in SYSCALL_DEFINE3()
4609 * Move a mount from one place to another. In combination with
4610 * fsopen()/fsmount() this is used to install a new mount and in combination
4612 * a mount subtree.
4693 bool is_path_reachable(struct mount *mnt, struct dentry *dentry, in is_path_reachable()
4734 * /nfs/my_root where /nfs is the mount point. It must be a mountpoint,
4735 * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root
4742 struct mount *new_mnt, *root_mnt, *old_mnt, *root_parent, *ex_parent; in SYSCALL_DEFINE2()
4811 /* mount old root on put_old */ in SYSCALL_DEFINE2()
4813 /* mount new_root on / */ in SYSCALL_DEFINE2()
4817 /* A moved mount should not expire automatically */ in SYSCALL_DEFINE2()
4839 static unsigned int recalc_flags(struct mount_kattr *kattr, struct mount *mnt) in recalc_flags()
4851 static int can_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt) in can_idmap_mount()
4860 * Creating an idmapped mount with the filesystem wide idmapping in can_idmap_mount()
4867 * We only allow an mount to change it's idmapping if it has in can_idmap_mount()
4885 /* Mount has already been visible in the filesystem hierarchy. */ in can_idmap_mount()
4894 * @kattr: the new mount attributes
4895 * @mnt: the mount to which @kattr will be applied
4897 * Check whether thew new mount attributes in @kattr allow concurrent writers.
4902 const struct mount *mnt) in mnt_allow_writers()
4909 static int mount_setattr_prepare(struct mount_kattr *kattr, struct mount *mnt) in mount_setattr_prepare()
4911 struct mount *m; in mount_setattr_prepare()
4935 struct mount *p; in mount_setattr_prepare()
4940 * mounts and needs to take care to include the first mount. in mount_setattr_prepare()
4948 * We're done once the first mount we changed got in mount_setattr_prepare()
4958 static void do_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt) in do_idmap_mount()
4972 static void mount_setattr_commit(struct mount_kattr *kattr, struct mount *mnt) in mount_setattr_commit()
4974 struct mount *m; in mount_setattr_commit()
4997 struct mount *mnt = real_mount(path->mnt); in do_mount_setattr()
5035 * If this is an attached mount make sure it's located in the callers in do_mount_setattr()
5036 * mount namespace. If it's not don't let the caller interact with it. in do_mount_setattr()
5038 * If this mount doesn't have a parent it's most often simply a in do_mount_setattr()
5039 * detached mount with an anonymous mount namespace. IOW, something in do_mount_setattr()
5041 * that do change mount properties on the rootfs itself. That obviously in do_mount_setattr()
5042 * neither has a parent nor is it a detached mount so we cannot in do_mount_setattr()
5049 * First, we get the mount tree in a shape where we can change mount in do_mount_setattr()
5112 * mount. We use the initial idmapping as an indicator of a mount in build_mount_idmapped()
5323 struct mount *mnt = mnt_find_id_at(ns, id); in lookup_mnt_in_ns()
5375 static u64 mnt_to_propagation_flags(struct mount *m) in mnt_to_propagation_flags()
5404 struct mount *m = real_mount(s->mnt); in statmount_mnt_basic()
5419 struct mount *m = real_mount(s->mnt); in statmount_propagate_from()
5477 struct mount *r = real_mount(s->mnt); in statmount_sb_source()
5619 * non-idmapped mount and an idmapped mount where none of the in statmount_mnt_uidmap()
5639 * non-idmapped mount and an idmapped mount where none of the in statmount_mnt_gidmap()
5749 static struct mount *listmnt_next(struct mount *curr, bool reverse) in listmnt_next()
5763 struct mount *first, *child; in grab_requested_root()
5774 * We have to find the first mount in our ns and use that, however it in grab_requested_root()
5813 struct mount *m; in do_statmount()
5963 /* The first valid unique mount id is MNT_UNIQUE_ID_OFFSET + 1. */ in copy_mnt_id_req()
5970 * If the user requested a specific mount namespace id, look that up and return
5971 * that, or if not simply grab a passive reference on our mount namespace and
6059 struct mount *r, *first; in do_listmount()
6128 * If the mount namespace really has more than 1 million mounts the in SYSCALL_DEFINE4()
6129 * caller must iterate over the mount namespace (and reconsider their in SYSCALL_DEFINE4()
6143 /* The first valid unique mount id is MNT_UNIQUE_ID_OFFSET + 1. */ in SYSCALL_DEFINE4()
6175 struct mount *m; in init_mount_tree()
6207 mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct mount), in mnt_init()
6210 mount_hashtable = alloc_large_system_hash("Mount-cache", in mnt_init()
6222 panic("Failed to allocate mount hash table\n"); in mnt_init()
6252 * it is a longterm mount, don't release mnt until in kern_mount()
6263 /* release long term mount so mount point can be released */ in kern_unmount()
6318 struct mount *mnt, *n; in mnt_already_visible()
6323 struct mount *child; in mnt_already_visible()
6329 /* This mount is not fully visible if it's root directory in mnt_already_visible()
6335 /* A local view of the mount flags */ in mnt_already_visible()
6342 /* Verify the mount flags are equal to or more permissive in mnt_already_visible()
6343 * than the proposed new mount. in mnt_already_visible()
6352 /* This mount is not fully visible if there are any in mnt_already_visible()
6495 .procname = "mount-max",