Lines Matching refs:mount
30 #include <uapi/linux/mount.h>
37 /* Maximum number of mounts in a mount namespace */
105 static int mnt_alloc_id(struct mount *mnt)
115 static void mnt_free_id(struct mount *mnt)
123 static int mnt_alloc_group_id(struct mount *mnt)
136 void mnt_release_group_id(struct mount *mnt)
145 static inline void mnt_add_count(struct mount *mnt, int n)
159 int mnt_get_count(struct mount *mnt)
175 static struct mount *alloc_vfsmnt(const char *name)
177 struct mount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
237 * __mnt_is_readonly: check whether a mount is read-only
238 * @mnt: the mount to check for its write status
253 static inline void mnt_inc_writers(struct mount *mnt)
262 static inline void mnt_dec_writers(struct mount *mnt)
271 static unsigned int mnt_get_writers(struct mount *mnt)
303 * __mnt_want_write - get write access to a mount without freeze protection
304 * @m: the mount on which to take a write
314 struct mount *mnt = real_mount(m);
343 * mnt_want_write - get write access to a mount
344 * @m: the mount on which to take a write
347 * it, and makes sure that writes are allowed (mount is read-write, filesystem
364 * mnt_clone_write - get write access to a mount
365 * @mnt: the mount on which to take a write
388 * __mnt_want_write_file - get write access to a file's mount
389 * @file: the file who's mount on which to take a write
403 * mnt_want_write_file - get write access to a file's mount
404 * @file: the file who's mount on which to take a write
422 * __mnt_drop_write - give up write access to a mount
423 * @mnt: the mount on which to give up write access
437 * mnt_drop_write - give up write access to a mount
438 * @mnt: the mount on which to give up write access
463 static int mnt_make_readonly(struct mount *mnt)
505 static int __mnt_unmake_readonly(struct mount *mnt)
515 struct mount *mnt;
549 static void free_vfsmnt(struct mount *mnt)
560 free_vfsmnt(container_of(head, struct mount, mnt_rcu));
566 struct mount *mnt;
606 * find the first mount at @dentry on vfsmount @mnt.
609 struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry)
612 struct mount *p;
621 * lookup_mnt - Return the first child mount mounted at path
626 * mount /dev/sda1 /mnt
627 * mount /dev/sda2 /mnt
628 * mount /dev/sda3 /mnt
630 * Then lookup_mnt() on the base /mnt dentry in the root mount will
638 struct mount *child_mnt;
662 static inline bool mnt_is_cursor(struct mount *mnt)
669 * current mount namespace.
674 * mounts in the current mount namespace and test to see if the dentry
678 * need to identify all mounts that may be in the current mount
679 * namespace not just a mount that happens to have some specified
680 * parent mount.
685 struct mount *mnt;
791 static inline int check_mnt(struct mount *mnt)
821 static struct mountpoint *unhash_mnt(struct mount *mnt)
837 static void umount_mnt(struct mount *mnt)
845 void mnt_set_mountpoint(struct mount *mnt,
847 struct mount *child_mnt)
857 static void __attach_mnt(struct mount *mnt, struct mount *parent)
867 static void attach_mnt(struct mount *mnt,
868 struct mount *parent,
875 void mnt_change_mountpoint(struct mount *parent, struct mountpoint *mp, struct mount *mnt)
878 struct mount *old_parent = mnt->mnt_parent;
893 static void commit_tree(struct mount *mnt)
895 struct mount *parent = mnt->mnt_parent;
896 struct mount *m;
915 static struct mount *next_mnt(struct mount *p, struct mount *root)
928 return list_entry(next, struct mount, mnt_child);
931 static struct mount *skip_mnt_tree(struct mount *p)
935 p = list_entry(prev, struct mount, mnt_child);
942 * vfs_create_mount - Create a mount for a configured superblock
945 * Create a mount to an already configured superblock. If necessary, the
948 * Note that this does not attach the mount to anything.
952 struct mount *mnt;
1023 * through from the parent mount to the submount don't support
1033 static struct mount *clone_mnt(struct mount *old, struct dentry *root,
1037 struct mount *mnt;
1084 /* stick the duplicate mount on the same expiry list
1099 static void cleanup_mnt(struct mount *mnt)
1102 struct mount *m;
1126 cleanup_mnt(container_of(head, struct mount, mnt_rcu));
1133 struct mount *m, *t;
1140 static void mntput_no_expire(struct mount *mnt)
1185 struct mount *p, *tmp;
1211 struct mount *m = real_mount(mnt);
1228 /* path_is_mountpoint() - Check if path is a mount in the current
1259 struct mount *p;
1268 static struct mount *mnt_list_next(struct mnt_namespace *ns,
1271 struct mount *mnt, *ret = NULL;
1309 struct mount *mnt = v;
1318 struct mount *mnt = v;
1332 struct mount *r = v;
1343 void mnt_cursor_del(struct mnt_namespace *ns, struct mount *cursor)
1354 * may_umount_tree - check if a mount tree is busy
1355 * @mnt: root of mount tree
1363 struct mount *mnt = real_mount(m);
1366 struct mount *p;
1386 * may_umount - check if a mount point is busy
1387 * @mnt: root of mount
1389 * This is called to check if a mount point has any
1391 * mount has sub mounts this will return busy
1416 struct mount *m;
1448 static bool disconnect_mount(struct mount *mnt, enum umount_tree_flags how)
1454 /* A mount without a parent has nothing to be connected to */
1465 /* Has it been requested that the mount remain connected? */
1469 /* Is the mount locked such that it needs to remain connected? */
1473 /* By default disconnect the mount */
1481 static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
1484 struct mount *p;
1507 p = list_first_entry(&tmp_list, struct mount, mnt_list);
1535 static void shrink_submounts(struct mount *mnt);
1560 static int do_umount(struct mount *mnt, int flags)
1597 * mount, and they will themselves hold resources we must
1601 * must return, and the like. Thats for the mount program to worry
1660 * to an existing mountpoint, and wind up leaking the mount.
1669 struct mount *mnt;
1679 mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);
1704 "WARNING: the mand mount option is being deprecated and\n"
1712 pr_warn("VFS: \"mand\" mount option not supported");
1719 struct mount *mnt = real_mount(path->mnt);
1737 struct mount *mnt = real_mount(path->mnt);
1787 /* Is this a proxy for a mount namespace? */
1804 /* Could bind mounting the mount namespace inode cause a
1805 * mount namespace loop?
1815 struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1818 struct mount *res, *p, *q, *r, *parent;
1834 struct mount *s;
1884 struct mount *tree;
1927 static bool has_locked_children(struct mount *mnt, struct dentry *dentry)
1929 struct mount *child;
1946 * to the originating mount won't be propagated into this).
1952 struct mount *old_mnt = real_mount(path->mnt);
1953 struct mount *new_mnt;
1971 /* Longterm mount to be removed by kern_unmount*() */
1985 struct mount *mnt;
1997 static void lock_mnt_tree(struct mount *mnt)
1999 struct mount *p;
2003 /* Don't allow unprivileged users to change mount flags */
2017 /* Don't allow unprivileged users to reveal what is under a mount */
2024 static void cleanup_group_ids(struct mount *mnt, struct mount *end)
2026 struct mount *p;
2034 static int invent_group_ids(struct mount *mnt, bool recurse)
2036 struct mount *p;
2051 int count_mounts(struct mnt_namespace *ns, struct mount *mnt)
2055 struct mount *p;
2074 * @source_mnt : mount tree to be attached
2075 * @nd : place the mount tree @source_mnt is attached
2077 * store the parent mount and mountpoint dentry.
2080 * NOTE: in the table below explains the semantics when a source mount
2081 * of a given type is attached to a destination mount of a given type.
2094 * A bind operation clones the source mount and mounts the clone on the
2095 * destination mount.
2097 * (++) the cloned mount is propagated to all the mounts in the propagation
2098 * tree of the destination mount and the cloned mount is added to
2099 * the peer group of the source mount.
2100 * (+) the cloned mount is created under the destination mount and is marked
2101 * as shared. The cloned mount is added to the peer group of the source
2102 * mount.
2103 * (+++) the mount is propagated to all the mounts in the propagation tree
2104 * of the destination mount and the cloned mount is made slave
2105 * of the same master as that of the source mount. The cloned mount
2107 * (*) the cloned mount is made a slave of the same master as that of the
2108 * source mount.
2123 * (+) the mount is moved to the destination. And is then propagated to
2124 * all the mounts in the propagation tree of the destination mount.
2125 * (+*) the mount is moved to the destination.
2126 * (+++) the mount is moved to the destination and is then propagated to
2127 * all the mounts belonging to the destination mount's propagation tree.
2128 * the mount is marked as 'shared and slave'.
2129 * (*) the mount continues to be a slave at the new location.
2131 * if the source mount is a tree, the operations explained above is
2132 * applied to each mount in the tree.
2136 static int attach_recursive_mnt(struct mount *source_mnt,
2137 struct mount *dest_mnt,
2145 struct mount *child, *p;
2156 /* Is there space to add these mounts to the mount namespace? */
2190 struct mount *q;
2209 child = hlist_entry(tree_list.first, struct mount, mnt_hash);
2266 static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp)
2300 struct mount *m;
2301 struct mount *mnt = real_mount(path->mnt);
2330 static struct mount *__do_loopback(struct path *old_path, int recurse)
2332 struct mount *mnt = ERR_PTR(-EINVAL), *old = real_mount(old_path->mnt);
2355 * do loopback mount.
2361 struct mount *mnt = NULL, *parent;
2407 struct mount *mnt, *p;
2494 * Don't allow locked mount flags to be cleared.
2499 static bool can_change_locked_flags(struct mount *mnt, unsigned int mnt_flags)
2526 static int change_mount_ro_state(struct mount *mnt, unsigned int mnt_flags)
2540 * Update the user-settable attributes on a mount. The caller must hold
2543 static void set_mount_attributes(struct mount *mnt, unsigned int mnt_flags)
2577 * to mount(2).
2582 struct mount *mnt = real_mount(path->mnt);
2615 struct mount *mnt = real_mount(path->mnt);
2633 * from the legacy mount system call.
2655 static inline int tree_contains_unbindable(struct mount *mnt)
2657 struct mount *p;
2666 * Check that there aren't references to earlier/same mount namespaces in the
2667 * specified subtree. Such references can act as pins for mount namespaces
2668 * that aren't checked by the mount-cycle checking code, thereby allowing
2671 static bool check_for_nsfs_mounts(struct mount *subtree)
2673 struct mount *p;
2690 struct mount *p;
2691 struct mount *old;
2692 struct mount *parent;
2731 * Don't move a mount residing in a shared parent.
2736 * Don't move a mount tree containing unbindable mounts to a destination
2737 * mount which is shared.
2753 /* if the mount is moved, it should no longer be expire
2787 * add a mount into a namespace's mount tree
2789 static int do_add_mount(struct mount *newmnt, struct mountpoint *mp,
2792 struct mount *parent = real_mount(path->mnt);
2805 /* Refuse the same filesystem on the same mount point */
2820 * Create a new mount using a superblock configuration and request it
2861 * create a new mount for userspace and request it to be added into the
2896 * Indicate to the filesystem that the mount request is coming
2897 * from the legacy mount system call.
2923 struct mount *mnt;
2932 /* The new mount record should have at least 2 refs to prevent it being
2946 * got", not "try to mount it on top".
2990 * mnt_set_expiry - Put a mount on an expiration list
2991 * @mnt: The mount to list.
2992 * @expiry_list: The list to add the mount to.
3011 struct mount *mnt, *next;
3033 mnt = list_first_entry(&graveyard, struct mount, mnt_expire);
3049 static int select_submounts(struct mount *parent, struct list_head *graveyard)
3051 struct mount *this_parent = parent;
3060 struct mount *mnt = list_entry(tmp, struct mount, mnt_child);
3095 static void shrink_submounts(struct mount *mnt)
3098 struct mount *m;
3103 m = list_first_entry(&graveyard, struct mount,
3154 * be given to the mount() call (ie: read-only, no-dev, no-suid etc).
3160 * Pre-0.97 versions of mount() didn't have a flags word.
3280 * mount a reference to an older mount namespace into the current
3281 * mount namespace, preventing reference counting loops. A 64bit
3328 struct mount *p, *q;
3329 struct mount *old;
3330 struct mount *new;
3404 struct mount *mnt = real_mount(m);
3439 SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
3474 * Create a kernel mount representation for a new, prepared superblock
3484 struct mount *mnt;
3541 /* There must be a valid superblock or we can't mount it */
3568 /* We've done the mount bit - now move the file context into more or
3614 * Move a mount from one place to another. In combination with
3615 * fsopen()/fsmount() this is used to install a new mount and in combination
3617 * a mount subtree.
3676 bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
3717 * /nfs/my_root where /nfs is the mount point. It must be a mountpoint,
3718 * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root
3725 struct mount *new_mnt, *root_mnt, *old_mnt, *root_parent, *ex_parent;
3794 /* mount old root on put_old */
3796 /* mount new_root on / */
3800 /* A moved mount should not expire automatically */
3823 struct mount *m;
3854 mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct mount),
3869 panic("Failed to allocate mount hash table\n");
3899 * it is a longterm mount, don't release mnt until
3910 /* release long term mount so mount point can be released */
3966 struct mount *mnt;
3972 struct mount *child;
3981 /* This mount is not fully visible if it's root directory
3987 /* A local view of the mount flags */
3994 /* Verify the mount flags are equal to or more permissive
3995 * than the proposed new mount.
4004 /* This mount is not fully visible if there are any