• Home
  • Raw
  • Download

Lines Matching +full:in +full:- +full:tree

1 .. SPDX-License-Identifier: GPL-2.0
11 4) Use-case
19 -----------
27 It provides the necessary building blocks for features like per-user-namespace
31 -----------
49 mount --make-shared /mnt
51 Note: mount(8) command now supports the --make-shared flag,
57 # mount --bind /mnt /tmp
94 # mount --make-shared /mnt
97 # mount --bind /mnt /tmp
103 # mount --make-slave /tmp
138 # mount --make-unbindable /mnt
142 # mount --bind /mnt /tmp
150 -----------------------
152 The mount command (util-linux package) can be used to set mount
155 mount --make-shared mountpoint
156 mount --make-slave mountpoint
157 mount --make-private mountpoint
158 mount --make-unbindable mountpoint
162 ------------
171 mount --bind /cdrom /cdrom
172 mount --make-shared /cdrom
175 mount at /cdrom which is a replica of the same mount in the
179 propagated to the other mount at /cdrom in all the other clone
187 To begin with, the administrator can mark the entire mount tree
190 mount --make-rshared /
195 mount --make-rslave /myprivatetree
198 process will not show up in any other namespace. However mounts
199 done in the parent namespace under /myprivatetree still shows
200 up in the process's namespace.
206 C) Per-user namespace
213 requirements. This needs to be supported in PAM.
217 If the entire mount tree is visible at multiple locations, then
224 mount --make-shared /
225 mount --rbind / /view/v1
226 mount --rbind / /view/v2
227 mount --rbind / /view/v3
228 mount --rbind / /view/v4
241 ---------------------
243 bind, rbind, move, mount, umount and clone-namespace operations.
250 A given mount can be in one of the following states
259 that leads to mount or unmount actions in other vfsmounts.
271 mount --make-shared /mnt
272 mount --bind /mnt /tmp
276 /mnt or /tmp reflect in all the other mounts of its peer
290 mount --make-slave mount
304 peer group, and this peer-group is a slave of some other
310 mount --make-shared mount
329 in response to various commands::
331 -----------------------------------------------------------------------
332 | |make-shared | make-slave | make-private |make-unbindab|
333 --------------|------------|--------------|--------------|-------------|
336 |-------------|------------|--------------|--------------|-------------|
339 |-------------|------------|--------------|--------------|-------------|
342 |-------------|------------|--------------|--------------|-------------|
344 |-------------|------------|--------------|--------------|-------------|
346 ------------------------------------------------------------------------
348 * if the shared mount is the only mount in its peer group, making it
352 ** slaving a non-shared mount has no effect on the mount.
356 explained in section 5d.
362 mount --bind A/a B/b
364 where 'A' is the source mount, 'a' is the dentry in the mount 'A', 'B'
365 is the destination mount and 'b' is the dentry in the destination mount.
370 --------------------------------------------------------------------------
373 |source(A)->| shared | private | slave | unbindable |
380 |non-shared| shared | private | slave | invalid |
389 propagates to. A new propagation tree containing 'C1',..,'Cn' is
390 created. This propagation tree is identical to the propagation tree of
391 'B'. And finally the peer-group of 'C' is merged with the peer group
398 propagates to. A new propagation tree is set containing all new mounts
400 propagation tree for 'B'.
406 'B' propagates to. A new propagation tree containing the new mounts
407 'C','C1',.. 'Cn' is created. This propagation tree is identical to the
408 propagation tree for 'B'. And finally the mount 'C' and its peer group
409 is made the slave of mount 'Z'. In other words, mount 'C' is in the
415 5. 'A' is a private mount and 'B' is a non-shared(private or slave or
419 6. 'A' is a shared mount and 'B' is a non-shared mount. A new mount 'C'
422 peer-group of 'A'.
424 7. 'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. A
427 slave mount of 'Z'. In other words 'A' and 'C' are both slave mounts of
432 8. 'A' is a unbindable mount and 'B' is a non-shared mount. This is a
438 replicates all the mounts in the tree belonging to the specified mount.
439 Rbind mount is bind mount applied to all the mounts in the tree.
441 If the source tree that is rbind has some unbindable mounts,
442 then the subtree under the unbindable mount is pruned in the new
447 let's say we have the following mount tree::
455 Let's say all the mount except the mount C in the tree are
458 If this tree is rbound to say Z
460 We will have the following tree at the new location::
466 B' Note how the tree under C is pruned
467 / \ in the new location.
476 mount --move A B/b
479 the dentry in the destination mount.
484 ---------------------------------------------------------------------------
487 | source(A)->| shared | private | slave | unbindable |
494 |non-shared| shared | private | slave | unbindable |
504 propagation from mount 'B'. A new propagation tree is created in the
505 exact same configuration as that of 'B'. This new propagation tree
507 propagation tree is appended to the already existing propagation tree
514 propagation tree is created which is identical to that of
515 'B'. This new propagation tree contains all the new mounts 'A1',
521 receive propagation from mount 'B'. A new propagation tree is created
522 in the exact same configuration as that of 'B'. This new propagation
523 tree contains all the new mounts 'A1', 'A2'... 'An'. And this new
524 propagation tree is appended to the already existing propagation tree of
534 5. 'A' is a private mount and 'B' is a non-shared(private or slave or
537 6. 'A' is a shared mount and 'B' is a non-shared mount. The mount 'A'
541 7. 'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount.
545 8. 'A' is a unbindable mount and 'B' is a non-shared mount. The mount
555 'B' is the destination mount and 'b' is the dentry in the destination
570 If mount 'B' is shared, then all most-recently-mounted mounts at dentry
572 sub-mounts within them are unmounted.
583 if 'C1' is unmounted, all the mounts that are most-recently-mounted on
584 'B1' and on the mounts that 'B1' propagates-to are unmounted.
593 to be unmounted and 'C1' has some sub-mounts, the umount operation is
601 Let's say 'A' and 'B' are the corresponding mounts in the parent and the
616 -------
622 mount --bind /mnt /mnt
623 mount --make-shared /mnt
624 mount --bind /mnt /tmp
625 mount --move /tmp /mnt/1
636 mount --make-rshared /
637 mkdir -p /v/1
638 mount --rbind / /v/1
647 mount --bind /mnt /mnt
648 mount --make-shared /mnt
649 mkdir -p /mnt/1/2/3 /mnt/1/test
650 mount --bind /mnt/1 /tmp
651 mount --make-slave /mnt
652 mount --make-shared /mnt
653 mount --bind /mnt/1/2 /tmp1
654 mount --make-slave /mnt
664 A -> B -> C
668 mount --bind /bin /tmp/test
678 ------
693 Let's say we want to replicate the mount tree at multiple
696 if one rbind mounts a tree within the same subtree 'n' times
702 let's say the root tree has just two directories with
709 And we want to replicate the tree at multiple
716 mount --make-shared /root
718 mkdir -p /tmp/m1
720 mount --rbind /root /tmp/m1
722 the new tree now looks like this::
739 mkdir -p /tmp/m2
740 mount --rbind /root /tmp/m2
742 the new tree now looks like this::
766 mkdir -p /tmp/m3
767 mount --rbind /root /tmp/m3
769 I won't draw the tree..but it has 24 vfsmounts
772 at step i the number of vfsmounts is V[i] = i*V[i-1].
773 This is an exponential function. And this tree has way more
774 mounts than what we really needed in the first place.
778 Unclonable mounts come in handy here.
781 let's say the root tree has just two directories with
788 How do we set up the same tree at multiple locations under
795 mount --bind /root/tmp /root/tmp
797 mount --make-rshared /root
798 mount --make-unbindable /root/tmp
800 mkdir -p /tmp/m1
802 mount --rbind /root /tmp/m1
804 the new tree now looks like this::
817 mkdir -p /tmp/m2
818 mount --rbind /root /tmp/m2
820 the new tree now looks like this::
833 mkdir -p /tmp/m3
834 mount --rbind /root /tmp/m3
836 the new tree now looks like this::
847 -----------------
853 * ->mnt_share
854 * ->mnt_slave_list
855 * ->mnt_slave
856 * ->mnt_master
858 ->mnt_share
862 ->mnt_slave_list
866 ->mnt_slave
870 ->mnt_master
874 ->mnt_flags
880 All the shared vfsmounts in a peer group form a cyclic list through
881 ->mnt_share.
883 All vfsmounts with the same ->mnt_master form on a cyclic list anchored
884 in ->mnt_master->mnt_slave_list and going through ->mnt_slave.
886 ->mnt_master can point to arbitrary (and possibly different) members
888 you need to go through _all_ ->mnt_slave_list of its members.
889 Conceptually it's just a single set - distribution among the
891 tree is modified by operations.
893 All vfsmounts in a peer group have the same ->mnt_master. If it is
894 non-NULL, they form a contiguous (ordered) segment of slave list.
896 A example propagation tree looks as shown in the figure below.
898 mounts as a conceptual entity called 'pnode', it becomes a tree]::
901 A <--> B <--> C <---> D
905 E<-->K
909 In the above figure A,B,C and D all are shared and propagate to each
915 A's ->mnt_share links with the ->mnt_share of 'B' 'C' and 'D'
917 A's ->mnt_slave_list links with ->mnt_slave of 'E', 'K', 'F' and 'G'
919 E's ->mnt_share links with ->mnt_share of K
921 'E', 'K', 'F', 'G' have their ->mnt_master point to struct vfsmount of 'A'
923 'M', 'L', 'N' have their ->mnt_master point to struct vfsmount of 'K'
925 K's ->mnt_slave_list links with ->mnt_slave of 'M', 'L' and 'N'
927 C's ->mnt_slave_list links with ->mnt_slave of 'J' and 'K'
929 J and K's ->mnt_master points to struct vfsmount of C
931 and finally D's ->mnt_slave_list links with ->mnt_slave of 'H' and 'I'
933 'H' and 'I' have their ->mnt_master pointing to struct vfsmount of 'D'.
936 NOTE: The propagation tree is orthogonal to the mount tree.
940 ->mnt_share, ->mnt_slave, ->mnt_slave_list, ->mnt_master are protected
943 Normally we have ->mnt_flags modifications serialized by vfsmount_lock.
945 The former modifies a vfsmount that has not been visible in any shared
948 are in lists that can't be traversed without namespace_sem.
952 The crux of the implementation resides in rbind/move operation.
963 for each mount in the source tree:
969 However note down its ->mnt_parent and ->mnt_mountpoint
970 c) Link all the new mounts to form a propagation tree that
971 is identical to the propagation tree of the destination
975 propagation trees; where 'n' is the number of mounts in the
976 source tree. Go to the commit phase
992 all the propagation related functionality resides in the file pnode.c
995 ------------------------------------------------------------------------