Lines Matching refs:mnt
37 static struct mount *get_peer_under_root(struct mount *mnt,
41 struct mount *m = mnt;
45 if (m->mnt_ns == ns && is_path_reachable(m, m->mnt.mnt_root, root))
49 } while (m != mnt);
60 int get_dominating_id(struct mount *mnt, const struct path *root)
64 for (m = mnt->mnt_master; m != NULL; m = m->mnt_master) {
65 struct mount *d = get_peer_under_root(m, mnt->mnt_ns, root);
73 static int do_make_slave(struct mount *mnt)
77 if (list_empty(&mnt->mnt_share)) {
78 if (IS_MNT_SHARED(mnt)) {
79 mnt_release_group_id(mnt);
80 CLEAR_MNT_SHARED(mnt);
82 master = mnt->mnt_master;
84 struct list_head *p = &mnt->mnt_slave_list;
96 * slave 'mnt' to a peer mount that has the
100 for (m = master = next_peer(mnt); m != mnt; m = next_peer(m)) {
101 if (m->mnt.mnt_root == mnt->mnt.mnt_root) {
106 list_del_init(&mnt->mnt_share);
107 mnt->mnt_group_id = 0;
108 CLEAR_MNT_SHARED(mnt);
110 list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave)
112 list_move(&mnt->mnt_slave, &master->mnt_slave_list);
113 list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev);
114 INIT_LIST_HEAD(&mnt->mnt_slave_list);
115 mnt->mnt_master = master;
122 void change_mnt_propagation(struct mount *mnt, int type)
125 set_mnt_shared(mnt);
128 do_make_slave(mnt);
130 list_del_init(&mnt->mnt_slave);
131 mnt->mnt_master = NULL;
133 mnt->mnt.mnt_flags |= MNT_UNBINDABLE;
135 mnt->mnt.mnt_flags &= ~MNT_UNBINDABLE;
233 if (!is_subdir(mp->m_dentry, m->mnt.mnt_root))
261 child = copy_tree(last_source, last_source->mnt.mnt_root, type);
336 static struct mount *find_topper(struct mount *mnt)
338 /* If there is exactly one mount covering mnt completely return it. */
341 if (!list_is_singular(&mnt->mnt_mounts))
344 child = list_first_entry(&mnt->mnt_mounts, struct mount, mnt_child);
345 if (child->mnt_mountpoint != mnt->mnt.mnt_root)
354 static inline int do_refcount_check(struct mount *mnt, int count)
356 return mnt_get_count(mnt) > count;
360 * check if the mount 'mnt' can be unmounted successfully.
361 * @mnt: the mount to be checked for unmount
362 * NOTE: unmounting 'mnt' would naturally propagate to all
369 int propagate_mount_busy(struct mount *mnt, int refcnt)
372 struct mount *parent = mnt->mnt_parent;
374 if (mnt == parent)
375 return do_refcount_check(mnt, refcnt);
382 if (!list_empty(&mnt->mnt_mounts) || do_refcount_check(mnt, refcnt))
388 child = __lookup_mnt(&m->mnt, mnt->mnt_mountpoint);
412 void propagate_mount_unlock(struct mount *mnt)
414 struct mount *parent = mnt->mnt_parent;
417 BUG_ON(parent == mnt);
421 child = __lookup_mnt(&m->mnt, mnt->mnt_mountpoint);
423 child->mnt.mnt_flags &= ~MNT_LOCKED;
427 static void umount_one(struct mount *mnt, struct list_head *to_umount)
429 CLEAR_MNT_MARK(mnt);
430 mnt->mnt.mnt_flags |= MNT_UMOUNT;
431 list_del_init(&mnt->mnt_child);
432 list_del_init(&mnt->mnt_umounting);
433 list_move_tail(&mnt->mnt_list, to_umount);
437 * NOTE: unmounting 'mnt' naturally propagates to all other mounts its
440 static bool __propagate_umount(struct mount *mnt,
451 if (mnt->mnt.mnt_flags & (MNT_UMOUNT | MNT_MARKED))
457 list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) {
458 if (child->mnt_mountpoint == mnt->mnt.mnt_root)
467 SET_MNT_MARK(mnt);
471 if (!IS_MNT_LOCKED(mnt)) {
472 umount_one(mnt, to_umount);
475 list_move_tail(&mnt->mnt_umounting, to_restore);
484 struct mount *mnt, *child, *tmp;
485 list_for_each_entry(mnt, to_umount, mnt_list) {
486 list_for_each_entry_safe(child, tmp, &mnt->mnt_mounts, mnt_child) {
488 if (child->mnt_mountpoint == mnt->mnt.mnt_root)
500 struct mount *mnt, *parent;
503 mnt = list_first_entry(to_restore, struct mount, mnt_umounting);
504 CLEAR_MNT_MARK(mnt);
505 list_del_init(&mnt->mnt_umounting);
508 mp = mnt->mnt_mp;
509 parent = mnt->mnt_parent;
510 while (parent->mnt.mnt_flags & MNT_UMOUNT) {
514 if (parent != mnt->mnt_parent)
515 mnt_change_mountpoint(parent, mp, mnt);
522 struct mount *mnt =
524 list_del_init(&mnt->mnt_umounting);
537 struct mount *mnt;
543 list_for_each_entry_reverse(mnt, list, mnt_list) {
544 struct mount *parent = mnt->mnt_parent;
553 if (!list_empty(&mnt->mnt_umounting))
556 list_add_tail(&mnt->mnt_umounting, &visited);
559 struct mount *child = __lookup_mnt(&m->mnt,
560 mnt->mnt_mountpoint);
574 } else if (child->mnt.mnt_flags & MNT_UMOUNT) {