Lines Matching refs:m

36 	struct mount *m = mnt;  in get_peer_under_root()  local
40 if (m->mnt_ns == ns && is_path_reachable(m, m->mnt.mnt_root, root)) in get_peer_under_root()
41 return m; in get_peer_under_root()
43 m = next_peer(m); in get_peer_under_root()
44 } while (m != mnt); in get_peer_under_root()
57 struct mount *m; in get_dominating_id() local
59 for (m = mnt->mnt_master; m != NULL; m = m->mnt_master) { in get_dominating_id()
60 struct mount *d = get_peer_under_root(m, mnt->mnt_ns, root); in get_dominating_id()
68 static inline bool will_be_unmounted(struct mount *m) in will_be_unmounted() argument
70 return m->mnt.mnt_flags & MNT_UMOUNT; in will_be_unmounted()
76 struct mount *m; in propagation_source() local
77 for (m = next_peer(mnt); m != mnt; m = next_peer(m)) { in propagation_source()
78 if (!will_be_unmounted(m)) in propagation_source()
79 return m; in propagation_source()
89 struct mount *m; in transfer_propagation() local
91 hlist_for_each_entry_safe(m, n, &mnt->mnt_slave_list, mnt_slave) { in transfer_propagation()
92 m->mnt_master = to; in transfer_propagation()
94 hlist_del_init(&m->mnt_slave); in transfer_propagation()
96 p = &m->mnt_slave; in transfer_propagation()
107 struct mount *m = mnt->mnt_master; in change_mnt_propagation() local
115 m = propagation_source(mnt); in change_mnt_propagation()
123 transfer_propagation(mnt, m); in change_mnt_propagation()
127 mnt->mnt_master = m; in change_mnt_propagation()
128 if (m) in change_mnt_propagation()
129 hlist_add_head(&mnt->mnt_slave, &m->mnt_slave_list); in change_mnt_propagation()
139 static struct mount *__propagation_next(struct mount *m, in __propagation_next() argument
143 struct mount *master = m->mnt_master; in __propagation_next()
146 struct mount *next = next_peer(m); in __propagation_next()
148 } else if (m->mnt_slave.next) in __propagation_next()
149 return next_slave(m); in __propagation_next()
152 m = master; in __propagation_next()
166 static struct mount *propagation_next(struct mount *m, in propagation_next() argument
170 if (!IS_MNT_NEW(m) && !hlist_empty(&m->mnt_slave_list)) in propagation_next()
171 return first_slave(m); in propagation_next()
173 return __propagation_next(m, origin); in propagation_next()
176 static struct mount *skip_propagation_subtree(struct mount *m, in skip_propagation_subtree() argument
182 struct mount *p = __propagation_next(m, origin); in skip_propagation_subtree()
184 while (p && peers(m, p)) in skip_propagation_subtree()
190 static struct mount *next_group(struct mount *m, struct mount *origin) in next_group() argument
195 if (!IS_MNT_NEW(m) && !hlist_empty(&m->mnt_slave_list)) in next_group()
196 return first_slave(m); in next_group()
197 next = next_peer(m); in next_group()
198 if (m->mnt_group_id == origin->mnt_group_id) { in next_group()
201 } else if (m->mnt_slave.next != &next->mnt_slave) in next_group()
203 m = next; in next_group()
207 struct mount *master = m->mnt_master; in next_group()
208 if (m->mnt_slave.next) in next_group()
209 return next_slave(m); in next_group()
210 m = next_peer(master); in next_group()
213 if (master->mnt_slave.next == &m->mnt_slave) in next_group()
215 m = master; in next_group()
217 if (m == origin) in next_group()
222 static bool need_secondary(struct mount *m, struct mountpoint *dest_mp) in need_secondary() argument
225 if (IS_MNT_NEW(m)) in need_secondary()
228 if (!is_subdir(dest_mp->m_dentry, m->mnt.mnt_root)) in need_secondary()
231 if (is_anon_ns(m->mnt_ns)) in need_secondary()
236 static struct mount *find_master(struct mount *m, in find_master() argument
244 p = m->mnt_master; in find_master()
247 m = p; in find_master()
252 if (!peers(parent, m)) in find_master()
276 struct mount *m, *n, *copy, *this; in propagate_mnt() local
283 for (m = dest_mnt; m && !err; m = next_group(m, dest_mnt)) { in propagate_mnt()
284 if (m == dest_mnt) { // have one for dest_mnt itself in propagate_mnt()
287 n = next_peer(m); in propagate_mnt()
288 if (n == m) in propagate_mnt()
293 if (IS_MNT_SHARED(m)) in propagate_mnt()
295 n = m; in propagate_mnt()
318 } while ((n = next_peer(n)) != m); in propagate_mnt()
322 m = n->mnt_parent; in propagate_mnt()
323 if (m->mnt_master) in propagate_mnt()
324 CLEAR_MNT_MARK(m->mnt_master); in propagate_mnt()
368 for (const struct mount *m = to; m; m = m->mnt_master) { in propagation_would_overmount() local
369 if (peers(from, m)) in propagation_would_overmount()
401 for (struct mount *m = propagation_next(parent, parent); m; in propagate_mount_busy() local
402 m = propagation_next(m, parent)) { in propagate_mount_busy()
404 struct mount *child = __lookup_mnt(&m->mnt, mnt->mnt_mountpoint); in propagate_mount_busy()
432 struct mount *m, *child; in propagate_mount_unlock() local
436 for (m = propagation_next(parent, parent); m; in propagate_mount_unlock()
437 m = propagation_next(m, parent)) { in propagate_mount_unlock()
438 child = __lookup_mnt(&m->mnt, mnt->mnt_mountpoint); in propagate_mount_unlock()
444 static inline bool is_candidate(struct mount *m) in is_candidate() argument
446 return m->mnt_t_flags & T_UMOUNT_CANDIDATE; in is_candidate()
449 static void umount_one(struct mount *m, struct list_head *to_umount) in umount_one() argument
451 m->mnt.mnt_flags |= MNT_UMOUNT; in umount_one()
452 list_del_init(&m->mnt_child); in umount_one()
453 move_from_ns(m); in umount_one()
454 list_add_tail(&m->mnt_list, to_umount); in umount_one()
457 static void remove_from_candidate_list(struct mount *m) in remove_from_candidate_list() argument
459 m->mnt_t_flags &= ~(T_MARKED | T_UMOUNT_CANDIDATE); in remove_from_candidate_list()
460 list_del_init(&m->mnt_list); in remove_from_candidate_list()
466 struct mount *m, *p, *q; in gather_candidates() local
468 list_for_each_entry(m, set, mnt_list) { in gather_candidates()
469 if (is_candidate(m)) in gather_candidates()
471 m->mnt_t_flags |= T_UMOUNT_CANDIDATE; in gather_candidates()
472 p = m->mnt_parent; in gather_candidates()
476 m->mnt_mountpoint); in gather_candidates()
496 list_for_each_entry(m, set, mnt_list) in gather_candidates()
497 m->mnt_t_flags &= ~T_UMOUNT_CANDIDATE; in gather_candidates()
505 static void trim_ancestors(struct mount *m) in trim_ancestors() argument
509 for (p = m->mnt_parent; is_candidate(p); m = p, p = p->mnt_parent) { in trim_ancestors()
510 if (IS_MNT_MARKED(m)) // all candidates beneath are overmounts in trim_ancestors()
512 SET_MNT_MARK(m); in trim_ancestors()
513 if (m != p->overmount) in trim_ancestors()
528 static void trim_one(struct mount *m, struct list_head *to_umount) in trim_one() argument
533 if (!is_candidate(m)) { // trim_ancestors() left it on list in trim_one()
534 remove_from_candidate_list(m); in trim_one()
538 list_for_each_entry(n, &m->mnt_mounts, mnt_child) { in trim_one()
541 if (n != m->overmount) { in trim_one()
548 trim_ancestors(m); in trim_one()
549 } else if (!IS_MNT_LOCKED(m) && list_empty(&m->mnt_mounts)) { in trim_one()
554 remove_from_candidate_list(m); in trim_one()
556 umount_one(m, to_umount); in trim_one()
560 static void handle_locked(struct mount *m, struct list_head *to_umount) in handle_locked() argument
562 struct mount *cutoff = m, *p; in handle_locked()
564 if (!is_candidate(m)) { // trim_ancestors() left it on list in handle_locked()
565 remove_from_candidate_list(m); in handle_locked()
568 for (p = m; is_candidate(p); p = p->mnt_parent) { in handle_locked()
575 while (m != cutoff) { in handle_locked()
576 umount_one(m, to_umount); in handle_locked()
577 m = m->mnt_parent; in handle_locked()
594 static void reparent(struct mount *m) in reparent() argument
596 struct mount *p = m; in reparent()
604 mnt_change_mountpoint(p, mp, m); in reparent()
605 mnt_notify_add(m); in reparent()
623 struct mount *m, *p; in propagate_umount() local
631 list_for_each_entry_safe(m, p, &candidates, mnt_list) in propagate_umount()
632 trim_one(m, &to_umount); in propagate_umount()
636 m = list_first_entry(&candidates,struct mount, mnt_list); in propagate_umount()
637 handle_locked(m, &to_umount); in propagate_umount()
642 list_for_each_entry(m, &to_umount, mnt_list) { in propagate_umount()
643 struct mount *over = m->overmount; in propagate_umount()