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;
232 if (!is_subdir(dest_mp->m_dentry, m->mnt.mnt_root))
260 child = copy_tree(last_source, last_source->mnt.mnt_root, type);
334 static struct mount *find_topper(struct mount *mnt)
336 /* If there is exactly one mount covering mnt completely return it. */
339 if (!list_is_singular(&mnt->mnt_mounts))
342 child = list_first_entry(&mnt->mnt_mounts, struct mount, mnt_child);
343 if (child->mnt_mountpoint != mnt->mnt.mnt_root)
352 static inline int do_refcount_check(struct mount *mnt, int count)
354 return mnt_get_count(mnt) > count;
386 if (to->mnt.mnt_root != mp->m_dentry)
398 * check if the mount 'mnt' can be unmounted successfully.
399 * @mnt: the mount to be checked for unmount
400 * NOTE: unmounting 'mnt' would naturally propagate to all
407 int propagate_mount_busy(struct mount *mnt, int refcnt)
410 struct mount *parent = mnt->mnt_parent;
412 if (mnt == parent)
413 return do_refcount_check(mnt, refcnt);
420 if (!list_empty(&mnt->mnt_mounts) || do_refcount_check(mnt, refcnt))
426 child = __lookup_mnt(&m->mnt, mnt->mnt_mountpoint);
450 void propagate_mount_unlock(struct mount *mnt)
452 struct mount *parent = mnt->mnt_parent;
455 BUG_ON(parent == mnt);
459 child = __lookup_mnt(&m->mnt, mnt->mnt_mountpoint);
461 child->mnt.mnt_flags &= ~MNT_LOCKED;
465 static void umount_one(struct mount *mnt, struct list_head *to_umount)
467 CLEAR_MNT_MARK(mnt);
468 mnt->mnt.mnt_flags |= MNT_UMOUNT;
469 list_del_init(&mnt->mnt_child);
470 list_del_init(&mnt->mnt_umounting);
471 list_move_tail(&mnt->mnt_list, to_umount);
475 * NOTE: unmounting 'mnt' naturally propagates to all other mounts its
478 static bool __propagate_umount(struct mount *mnt,
489 if (mnt->mnt.mnt_flags & (MNT_UMOUNT | MNT_MARKED))
495 list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) {
496 if (child->mnt_mountpoint == mnt->mnt.mnt_root)
505 SET_MNT_MARK(mnt);
509 if (!IS_MNT_LOCKED(mnt)) {
510 umount_one(mnt, to_umount);
513 list_move_tail(&mnt->mnt_umounting, to_restore);
522 struct mount *mnt, *child, *tmp;
523 list_for_each_entry(mnt, to_umount, mnt_list) {
524 list_for_each_entry_safe(child, tmp, &mnt->mnt_mounts, mnt_child) {
526 if (child->mnt_mountpoint == mnt->mnt.mnt_root)
538 struct mount *mnt, *parent;
541 mnt = list_first_entry(to_restore, struct mount, mnt_umounting);
542 CLEAR_MNT_MARK(mnt);
543 list_del_init(&mnt->mnt_umounting);
546 mp = mnt->mnt_mp;
547 parent = mnt->mnt_parent;
548 while (parent->mnt.mnt_flags & MNT_UMOUNT) {
552 if (parent != mnt->mnt_parent)
553 mnt_change_mountpoint(parent, mp, mnt);
560 struct mount *mnt =
562 list_del_init(&mnt->mnt_umounting);
575 struct mount *mnt;
581 list_for_each_entry_reverse(mnt, list, mnt_list) {
582 struct mount *parent = mnt->mnt_parent;
591 if (!list_empty(&mnt->mnt_umounting))
594 list_add_tail(&mnt->mnt_umounting, &visited);
597 struct mount *child = __lookup_mnt(&m->mnt,
598 mnt->mnt_mountpoint);
612 } else if (child->mnt.mnt_flags & MNT_UMOUNT) {