Lines Matching full:mount

9 #include <linux/mount.h>
12 #include <uapi/linux/mount.h>
16 /* return the next shared peer mount of @p */
17 static inline struct mount *next_peer(struct mount *p) in next_peer()
19 return list_entry(p->mnt_share.next, struct mount, mnt_share); in next_peer()
22 static inline struct mount *first_slave(struct mount *p) in first_slave()
24 return list_entry(p->mnt_slave_list.next, struct mount, mnt_slave); in first_slave()
27 static inline struct mount *last_slave(struct mount *p) in last_slave()
29 return list_entry(p->mnt_slave_list.prev, struct mount, mnt_slave); in last_slave()
32 static inline struct mount *next_slave(struct mount *p) in next_slave()
34 return list_entry(p->mnt_slave.next, struct mount, mnt_slave); in next_slave()
37 static struct mount *get_peer_under_root(struct mount *mnt, in get_peer_under_root()
41 struct mount *m = mnt; in get_peer_under_root()
60 int get_dominating_id(struct mount *mnt, const struct path *root) in get_dominating_id()
62 struct mount *m; in get_dominating_id()
65 struct mount *d = get_peer_under_root(m, mnt->mnt_ns, root); in get_dominating_id()
73 static int do_make_slave(struct mount *mnt) in do_make_slave()
75 struct mount *master, *slave_mnt; in do_make_slave()
87 struct mount, mnt_slave); in do_make_slave()
94 struct mount *m; in do_make_slave()
96 * slave 'mnt' to a peer mount that has the in do_make_slave()
122 void change_mnt_propagation(struct mount *mnt, int type) in change_mnt_propagation()
140 * get the next mount in the propagation tree.
141 * @m: the mount seen last
142 * @origin: the original mount from where the tree walk initiated
149 static struct mount *propagation_next(struct mount *m, in propagation_next()
150 struct mount *origin) in propagation_next()
152 /* are there any slaves of this mount? */ in propagation_next()
157 struct mount *master = m->mnt_master; in propagation_next()
160 struct mount *next = next_peer(m); in propagation_next()
170 static struct mount *skip_propagation_subtree(struct mount *m, in skip_propagation_subtree()
171 struct mount *origin) in skip_propagation_subtree()
183 static struct mount *next_group(struct mount *m, struct mount *origin) in next_group()
187 struct mount *next; in next_group()
200 struct mount *master = m->mnt_master; in next_group()
216 static struct mount *last_dest, *first_source, *last_source, *dest_master;
219 static inline bool peers(const struct mount *m1, const struct mount *m2) in peers()
224 static int propagate_one(struct mount *m, struct mountpoint *dest_mp) in propagate_one()
226 struct mount *child; in propagate_one()
241 struct mount *n, *p; in propagate_one()
249 struct mount *parent = last_source->mnt_parent; in propagate_one()
279 * mount 'source_mnt' under the destination 'dest_mnt' at
280 * dentry 'dest_dentry'. And propagate that mount to
286 * @dest_mnt: destination mount.
288 * @source_mnt: source mount.
291 int propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp, in propagate_mnt()
292 struct mount *source_mnt, struct hlist_head *tree_list) in propagate_mnt()
294 struct mount *m, *n; in propagate_mnt()
338 static struct mount *find_topper(struct mount *mnt) in find_topper()
340 /* If there is exactly one mount covering mnt completely return it. */ in find_topper()
341 struct mount *child; in find_topper()
346 child = list_first_entry(&mnt->mnt_mounts, struct mount, mnt_child); in find_topper()
356 static inline int do_refcount_check(struct mount *mnt, int count) in do_refcount_check()
364 * @from: shared mount
365 * @to: mount to check
372 * If the root of the @to mount is equal to the future mountpoint @mp of
373 * the @to mount on @from then @to will be overmounted by whatever is
380 bool propagation_would_overmount(const struct mount *from, in propagation_would_overmount()
381 const struct mount *to, in propagation_would_overmount()
390 for (const struct mount *m = to; m; m = m->mnt_master) { in propagation_would_overmount()
399 * check if the mount 'mnt' can be unmounted successfully.
400 * @mnt: the mount to be checked for unmount
408 int propagate_mount_busy(struct mount *mnt, int refcnt) in propagate_mount_busy()
410 struct mount *m, *child, *topper; in propagate_mount_busy()
411 struct mount *parent = mnt->mnt_parent; in propagate_mount_busy()
417 * quickly check if the current mount can be unmounted. in propagate_mount_busy()
431 /* Is there exactly one mount on the child that covers in propagate_mount_busy()
451 void propagate_mount_unlock(struct mount *mnt) in propagate_mount_unlock()
453 struct mount *parent = mnt->mnt_parent; in propagate_mount_unlock()
454 struct mount *m, *child; in propagate_mount_unlock()
466 static void umount_one(struct mount *mnt, struct list_head *to_umount) in umount_one()
479 static bool __propagate_umount(struct mount *mnt, in __propagate_umount()
484 struct mount *child; in __propagate_umount()
487 * The state of the parent won't change if this mount is in __propagate_umount()
509 /* If a mount is without children and not locked umount it. */ in __propagate_umount()
523 struct mount *mnt, *child, *tmp; in umount_list()
539 struct mount *mnt, *parent; in restore_mounts()
542 mnt = list_first_entry(to_restore, struct mount, mnt_umounting); in restore_mounts()
546 /* Should this mount be reparented? */ in restore_mounts()
563 struct mount *mnt = in cleanup_umount_visitations()
564 list_first_entry(visited, struct mount, mnt_umounting); in cleanup_umount_visitations()
570 * collect all mounts that receive propagation from the mount in @list,
578 struct mount *mnt; in propagate_umount()
585 struct mount *parent = mnt->mnt_parent; in propagate_umount()
586 struct mount *m; in propagate_umount()
589 * If this mount has already been visited it is known that it's in propagate_umount()
600 struct mount *child = __lookup_mnt(&m->mnt, in propagate_umount()
618 * mount in a list that has not been visited in propagate_umount()