3sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget-/translations/zh_CN/filesystems/sharedsubtreemodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget-/translations/zh_TW/filesystems/sharedsubtreemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget-/translations/it_IT/filesystems/sharedsubtreemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget-/translations/ja_JP/filesystems/sharedsubtreemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget-/translations/ko_KR/filesystems/sharedsubtreemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget-/translations/sp_SP/filesystems/sharedsubtreemodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhG/var/lib/git/docbuild/linux/Documentation/filesystems/sharedsubtree.rsthKubhsection)}(hhh](htitle)}(hShared Subtreesh]hShared Subtrees}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(h|Contents: 1) Overview 2) Features 3) Setting mount states 4) Use-case 5) Detailed semantics 6) Quiz 7) FAQ 8) Implementationh]h|Contents: 1) Overview 2) Features 3) Setting mount states 4) Use-case 5) Detailed semantics 6) Quiz 7) FAQ 8) Implementation}hhsbah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubh)}(hhh](h)}(h 1) Overviewh]h 1) Overview}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(h!Consider the following situation:h]h!Consider the following situation:}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hA process wants to clone its own namespace, but still wants to access the CD that got mounted recently. Shared subtree semantics provide the necessary mechanism to accomplish the above.h]hA process wants to clone its own namespace, but still wants to access the CD that got mounted recently. Shared subtree semantics provide the necessary mechanism to accomplish the above.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhIt provides the necessary building blocks for features like per-user-namespace and versioned filesystem.h]hhIt provides the necessary building blocks for features like per-user-namespace and versioned filesystem.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]overviewah ]h"] 1) overviewah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h 2) Featuresh]h 2) Features}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hWShared subtree provides four different flavors of mounts; struct vfsmount to be preciseh]hWShared subtree provides four different flavors of mounts; struct vfsmount to be precise}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK!hjhhubh block_quote)}(hEa. shared mount b. slave mount c. private mount d. unbindable mount h]henumerated_list)}(hhh](h list_item)}(h shared mounth]h)}(hjJh]h shared mount}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hjHubah}(h]h ]h"]h$]h&]uh1jFhjCubjG)}(h slave mounth]h)}(hjah]h slave mount}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hj_ubah}(h]h ]h"]h$]h&]uh1jFhjCubjG)}(h private mounth]h)}(hjxh]h private mount}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hjvubah}(h]h ]h"]h$]h&]uh1jFhjCubjG)}(hunbindable mount h]h)}(hunbindable mounth]hunbindable mount}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hjubah}(h]h ]h"]h$]h&]uh1jFhjCubeh}(h]h ]h"]h$]h&]enumtype loweralphaprefixhsuffix.uh1jAhj=ubah}(h]h ]h"]h$]h&]uh1j;hhhK$hjhhubh)}(hm2a) A shared mount can be replicated to as many mountpoints and all the replicas continue to be exactly same.h]hm2a) A shared mount can be replicated to as many mountpoints and all the replicas continue to be exactly same.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK*hjhhubj<)}(hXHere is an example: Let's say /mnt has a mount that is shared:: mount --make-shared /mnt Note: mount(8) command now supports the --make-shared flag, so the sample 'smount' program is no longer needed and has been removed. :: # mount --bind /mnt /tmp The above command replicates the mount at /mnt to the mountpoint /tmp and the contents of both the mounts remain identical. :: #ls /mnt a b c #ls /tmp a b c Now let's say we mount a device at /tmp/a:: # mount /dev/sd0 /tmp/a #ls /tmp/a t1 t2 t3 #ls /mnt/a t1 t2 t3 Note that the mount has propagated to the mount at /mnt as well. And the same is true even when /dev/sd0 is mounted on /mnt/a. The contents will be visible under /tmp/a too. h](h)}(hHere is an example:h]hHere is an example:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hjubh)}(h+Let's say /mnt has a mount that is shared::h]h,Let’s say /mnt has a mount that is shared:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hjubh literal_block)}(hmount --make-shared /mnth]hmount --make-shared /mnt}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK1hjubh)}(hNote: mount(8) command now supports the --make-shared flag, so the sample 'smount' program is no longer needed and has been removed.h]hNote: mount(8) command now supports the --make-shared flag, so the sample ‘smount’ program is no longer needed and has been removed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK3hjubj)}(h# mount --bind /mnt /tmph]h# mount --bind /mnt /tmp}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK9hjubh)}(h{The above command replicates the mount at /mnt to the mountpoint /tmp and the contents of both the mounts remain identical.h]h{The above command replicates the mount at /mnt to the mountpoint /tmp and the contents of both the mounts remain identical.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK;hjubj)}(h#ls /mnt a b c #ls /tmp a b ch]h#ls /mnt a b c #ls /tmp a b c}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK@hjubh)}(h+Now let's say we mount a device at /tmp/a::h]h,Now let’s say we mount a device at /tmp/a:}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKFhjubj)}(hB# mount /dev/sd0 /tmp/a #ls /tmp/a t1 t2 t3 #ls /mnt/a t1 t2 t3h]hB# mount /dev/sd0 /tmp/a #ls /tmp/a t1 t2 t3 #ls /mnt/a t1 t2 t3}hj:sbah}(h]h ]h"]h$]h&]hhuh1jhhhKHhjubh)}(h@Note that the mount has propagated to the mount at /mnt as well.h]h@Note that the mount has propagated to the mount at /mnt as well.}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKPhjubh)}(hlAnd the same is true even when /dev/sd0 is mounted on /mnt/a. The contents will be visible under /tmp/a too.h]hlAnd the same is true even when /dev/sd0 is mounted on /mnt/a. The contents will be visible under /tmp/a too.}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKRhjubeh}(h]h ]h"]h$]h&]uh1j;hhhK-hjhhubhdefinition_list)}(hhh]hdefinition_list_item)}(hX?2b) A slave mount is like a shared mount except that mount and umount events only propagate towards it. All slave mounts have a master mount which is a shared. Here is an example: Let's say /mnt has a mount which is shared. # mount --make-shared /mnt Let's bind mount /mnt to /tmp # mount --bind /mnt /tmp the new mount at /tmp becomes a shared mount and it is a replica of the mount at /mnt. Now let's make the mount at /tmp; a slave of /mnt # mount --make-slave /tmp let's mount /dev/sd0 on /mnt/a # mount /dev/sd0 /mnt/a #ls /mnt/a t1 t2 t3 #ls /tmp/a t1 t2 t3 Note the mount event has propagated to the mount at /tmp However let's see what happens if we mount something on the mount at /tmp # mount /dev/sd1 /tmp/b #ls /tmp/b s1 s2 s3 #ls /mnt/b Note how the mount event has not propagated to the mount at /mnt h](hterm)}(hL2b) A slave mount is like a shared mount except that mount and umount eventsh]hL2b) A slave mount is like a shared mount except that mount and umount events}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhKhjqubh definition)}(hhh](h)}(honly propagate towards it.h]honly propagate towards it.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKWhjubh)}(h7All slave mounts have a master mount which is a shared.h]h7All slave mounts have a master mount which is a shared.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKYhjubh)}(hHere is an example:h]hHere is an example:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hjubh)}(hFLet's say /mnt has a mount which is shared. # mount --make-shared /mnth]hHLet’s say /mnt has a mount which is shared. # mount --make-shared /mnt}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK]hjubh)}(h6Let's bind mount /mnt to /tmp # mount --bind /mnt /tmph]h8Let’s bind mount /mnt to /tmp # mount --bind /mnt /tmp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK`hjubh)}(hVthe new mount at /tmp becomes a shared mount and it is a replica of the mount at /mnt.h]hVthe new mount at /tmp becomes a shared mount and it is a replica of the mount at /mnt.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKchjubh)}(hKNow let's make the mount at /tmp; a slave of /mnt # mount --make-slave /tmph]hMNow let’s make the mount at /tmp; a slave of /mnt # mount --make-slave /tmp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKfhjubh)}(h6let's mount /dev/sd0 on /mnt/a # mount /dev/sd0 /mnt/ah]h8let’s mount /dev/sd0 on /mnt/a # mount /dev/sd0 /mnt/a}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKihjubh)}(h#ls /mnt/a t1 t2 t3h]h#ls /mnt/a t1 t2 t3}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKlhjubh)}(h#ls /tmp/a t1 t2 t3h]h#ls /tmp/a t1 t2 t3}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKohjubh)}(h8Note the mount event has propagated to the mount at /tmph]h8Note the mount event has propagated to the mount at /tmp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKrhjubh)}(hIHowever let's see what happens if we mount something on the mount at /tmph]hKHowever let’s see what happens if we mount something on the mount at /tmp}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKthjubh)}(h# mount /dev/sd1 /tmp/bh]h# mount /dev/sd1 /tmp/b}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKvhjubh)}(h#ls /tmp/b s1 s2 s3h]h#ls /tmp/b s1 s2 s3}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKxhjubh)}(h #ls /mnt/bh]h #ls /mnt/b}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK{hjubh)}(h@Note how the mount event has not propagated to the mount at /mnth]h@Note how the mount event has not propagated to the mount at /mnt}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK}hjubeh}(h]h ]h"]h$]h&]uh1jhjqubeh}(h]h ]h"]h$]h&]uh1johhhKhjlubah}(h]h ]h"]h$]h&]uh1jjhjhhhhhNubh)}(h<2c) A private mount does not forward or receive propagation.h]h<2c) A private mount does not forward or receive propagation.}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj<)}(h?This is the mount we are familiar with. Its the default type. h]h)}(h=This is the mount we are familiar with. Its the default type.h]h=This is the mount we are familiar with. Its the default type.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j;hhhKhjhhubh)}(h42d) A unbindable mount is a unbindable private mounth]h42d) A unbindable mount is a unbindable private mount}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj<)}(hXVlet's say we have a mount at /mnt and we make it unbindable:: # mount --make-unbindable /mnt Let's try to bind mount this mount somewhere else:: # mount --bind /mnt /tmp mount: wrong fs type, bad option, bad superblock on /mnt, or too many mounted file systems Binding a unbindable mount is a invalid operation. h](h)}(h=let's say we have a mount at /mnt and we make it unbindable::h]h>let’s say we have a mount at /mnt and we make it unbindable:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(h # mount --make-unbindable /mnt Let's try to bind mount this mount somewhere else:: # mount --bind /mnt /tmp mount: wrong fs type, bad option, bad superblock on /mnt, or too many mounted file systemsh]h # mount --make-unbindable /mnt Let's try to bind mount this mount somewhere else:: # mount --bind /mnt /tmp mount: wrong fs type, bad option, bad superblock on /mnt, or too many mounted file systems}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubh)}(h2Binding a unbindable mount is a invalid operation.h]h2Binding a unbindable mount is a invalid operation.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j;hhhKhjhhubeh}(h]featuresah ]h"] 2) featuresah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h3) Setting mount statesh]h3) Setting mount states}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubj<)}(hThe mount command (util-linux package) can be used to set mount states:: mount --make-shared mountpoint mount --make-slave mountpoint mount --make-private mountpoint mount --make-unbindable mountpoint h](h)}(hHThe mount command (util-linux package) can be used to set mount states::h]hGThe mount command (util-linux package) can be used to set mount states:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(hmount --make-shared mountpoint mount --make-slave mountpoint mount --make-private mountpoint mount --make-unbindable mountpointh]hmount --make-shared mountpoint mount --make-slave mountpoint mount --make-private mountpoint mount --make-unbindable mountpoint}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubeh}(h]h ]h"]h$]h&]uh1j;hhhKhjhhubeh}(h]setting-mount-statesah ]h"]3) setting mount statesah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h 4) Use casesh]h 4) Use cases}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj+hhhhhKubj<)}(hX A) A process wants to clone its own namespace, but still wants to access the CD that got mounted recently. Solution: The system administrator can make the mount at /cdrom shared:: mount --bind /cdrom /cdrom mount --make-shared /cdrom Now any process that clones off a new namespace will have a mount at /cdrom which is a replica of the same mount in the parent namespace. So when a CD is inserted and mounted at /cdrom that mount gets propagated to the other mount at /cdrom in all the other clone namespaces. B) A process wants its mounts invisible to any other process, but still be able to see the other system mounts. Solution: To begin with, the administrator can mark the entire mount tree as shareable:: mount --make-rshared / A new process can clone off a new namespace. And mark some part of its namespace as slave:: mount --make-rslave /myprivatetree Hence forth any mounts within the /myprivatetree done by the process will not show up in any other namespace. However mounts done in the parent namespace under /myprivatetree still shows up in the process's namespace. Apart from the above semantics this feature provides the building blocks to solve the following problems: C) Per-user namespace The above semantics allows a way to share mounts across namespaces. But namespaces are associated with processes. If namespaces are made first class objects with user API to associate/disassociate a namespace with userid, then each user could have his/her own namespace and tailor it to his/her requirements. This needs to be supported in PAM. D) Versioned files If the entire mount tree is visible at multiple locations, then an underlying versioning file system can return different versions of the file depending on the path used to access that file. An example is:: mount --make-shared / mount --rbind / /view/v1 mount --rbind / /view/v2 mount --rbind / /view/v3 mount --rbind / /view/v4 and if /usr has a versioning filesystem mounted, then that mount appears at /view/v1/usr, /view/v2/usr, /view/v3/usr and /view/v4/usr too A user can request v3 version of the file /usr/fs/namespace.c by accessing /view/v3/usr/fs/namespace.c . The underlying versioning filesystem can then decipher that v3 version of the filesystem is being requested and return the corresponding inode. h](jB)}(hhh]jG)}(hX5A process wants to clone its own namespace, but still wants to access the CD that got mounted recently. Solution: The system administrator can make the mount at /cdrom shared:: mount --bind /cdrom /cdrom mount --make-shared /cdrom Now any process that clones off a new namespace will have a mount at /cdrom which is a replica of the same mount in the parent namespace. So when a CD is inserted and mounted at /cdrom that mount gets propagated to the other mount at /cdrom in all the other clone namespaces. h](h)}(hgA process wants to clone its own namespace, but still wants to access the CD that got mounted recently.h]hgA process wants to clone its own namespace, but still wants to access the CD that got mounted recently.}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjCubh)}(h Solution:h]h Solution:}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjCubj<)}(hXThe system administrator can make the mount at /cdrom shared:: mount --bind /cdrom /cdrom mount --make-shared /cdrom Now any process that clones off a new namespace will have a mount at /cdrom which is a replica of the same mount in the parent namespace. So when a CD is inserted and mounted at /cdrom that mount gets propagated to the other mount at /cdrom in all the other clone namespaces. h](h)}(h>The system administrator can make the mount at /cdrom shared::h]h=The system administrator can make the mount at /cdrom shared:}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjcubj)}(h5mount --bind /cdrom /cdrom mount --make-shared /cdromh]h5mount --bind /cdrom /cdrom mount --make-shared /cdrom}hjusbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjcubh)}(hNow any process that clones off a new namespace will have a mount at /cdrom which is a replica of the same mount in the parent namespace.h]hNow any process that clones off a new namespace will have a mount at /cdrom which is a replica of the same mount in the parent namespace.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjcubh)}(hSo when a CD is inserted and mounted at /cdrom that mount gets propagated to the other mount at /cdrom in all the other clone namespaces.h]hSo when a CD is inserted and mounted at /cdrom that mount gets propagated to the other mount at /cdrom in all the other clone namespaces.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjcubeh}(h]h ]h"]h$]h&]uh1j;hhhKhjCubeh}(h]h ]h"]h$]h&]uh1jFhj@ubah}(h]h ]h"]h$]h&]j upperalphajhj)uh1jAhj<ubh)}(hoB) A process wants its mounts invisible to any other process, but still be able to see the other system mounts.h]hoB) A process wants its mounts invisible to any other process, but still be able to see the other system mounts.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj<ubj<)}(hX Solution: To begin with, the administrator can mark the entire mount tree as shareable:: mount --make-rshared / A new process can clone off a new namespace. And mark some part of its namespace as slave:: mount --make-rslave /myprivatetree Hence forth any mounts within the /myprivatetree done by the process will not show up in any other namespace. However mounts done in the parent namespace under /myprivatetree still shows up in the process's namespace. h](h)}(h Solution:h]h Solution:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj<)}(hXTo begin with, the administrator can mark the entire mount tree as shareable:: mount --make-rshared / A new process can clone off a new namespace. And mark some part of its namespace as slave:: mount --make-rslave /myprivatetree Hence forth any mounts within the /myprivatetree done by the process will not show up in any other namespace. However mounts done in the parent namespace under /myprivatetree still shows up in the process's namespace. h](h)}(hNTo begin with, the administrator can mark the entire mount tree as shareable::h]hMTo begin with, the administrator can mark the entire mount tree as shareable:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(hmount --make-rshared /h]hmount --make-rshared /}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubh)}(h[A new process can clone off a new namespace. And mark some part of its namespace as slave::h]hZA new process can clone off a new namespace. And mark some part of its namespace as slave:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(h"mount --make-rslave /myprivatetreeh]h"mount --make-rslave /myprivatetree}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubh)}(hHence forth any mounts within the /myprivatetree done by the process will not show up in any other namespace. However mounts done in the parent namespace under /myprivatetree still shows up in the process's namespace.h]hHence forth any mounts within the /myprivatetree done by the process will not show up in any other namespace. However mounts done in the parent namespace under /myprivatetree still shows up in the process’s namespace.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j;hhhKhjubeh}(h]h ]h"]h$]h&]uh1j;hhhKhj<ubh)}(hiApart from the above semantics this feature provides the building blocks to solve the following problems:h]hiApart from the above semantics this feature provides the building blocks to solve the following problems:}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj<ubjB)}(hhh](jG)}(hXPer-user namespace The above semantics allows a way to share mounts across namespaces. But namespaces are associated with processes. If namespaces are made first class objects with user API to associate/disassociate a namespace with userid, then each user could have his/her own namespace and tailor it to his/her requirements. This needs to be supported in PAM. h](h)}(hPer-user namespaceh]hPer-user namespace}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:ubj<)}(hXYThe above semantics allows a way to share mounts across namespaces. But namespaces are associated with processes. If namespaces are made first class objects with user API to associate/disassociate a namespace with userid, then each user could have his/her own namespace and tailor it to his/her requirements. This needs to be supported in PAM. h]h)}(hXXThe above semantics allows a way to share mounts across namespaces. But namespaces are associated with processes. If namespaces are made first class objects with user API to associate/disassociate a namespace with userid, then each user could have his/her own namespace and tailor it to his/her requirements. This needs to be supported in PAM.h]hXXThe above semantics allows a way to share mounts across namespaces. But namespaces are associated with processes. If namespaces are made first class objects with user API to associate/disassociate a namespace with userid, then each user could have his/her own namespace and tailor it to his/her requirements. This needs to be supported in PAM.}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjLubah}(h]h ]h"]h$]h&]uh1j;hhhKhj:ubeh}(h]h ]h"]h$]h&]uh1jFhj7ubjG)}(hX=Versioned files If the entire mount tree is visible at multiple locations, then an underlying versioning file system can return different versions of the file depending on the path used to access that file. An example is:: mount --make-shared / mount --rbind / /view/v1 mount --rbind / /view/v2 mount --rbind / /view/v3 mount --rbind / /view/v4 and if /usr has a versioning filesystem mounted, then that mount appears at /view/v1/usr, /view/v2/usr, /view/v3/usr and /view/v4/usr too A user can request v3 version of the file /usr/fs/namespace.c by accessing /view/v3/usr/fs/namespace.c . The underlying versioning filesystem can then decipher that v3 version of the filesystem is being requested and return the corresponding inode. h](h)}(hVersioned filesh]hVersioned files}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjjubj<)}(hXIf the entire mount tree is visible at multiple locations, then an underlying versioning file system can return different versions of the file depending on the path used to access that file. An example is:: mount --make-shared / mount --rbind / /view/v1 mount --rbind / /view/v2 mount --rbind / /view/v3 mount --rbind / /view/v4 and if /usr has a versioning filesystem mounted, then that mount appears at /view/v1/usr, /view/v2/usr, /view/v3/usr and /view/v4/usr too A user can request v3 version of the file /usr/fs/namespace.c by accessing /view/v3/usr/fs/namespace.c . The underlying versioning filesystem can then decipher that v3 version of the filesystem is being requested and return the corresponding inode. h](h)}(hIf the entire mount tree is visible at multiple locations, then an underlying versioning file system can return different versions of the file depending on the path used to access that file.h]hIf the entire mount tree is visible at multiple locations, then an underlying versioning file system can return different versions of the file depending on the path used to access that file.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj|ubh)}(hAn example is::h]hAn example is:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj|ubj)}(hymount --make-shared / mount --rbind / /view/v1 mount --rbind / /view/v2 mount --rbind / /view/v3 mount --rbind / /view/v4h]hymount --make-shared / mount --rbind / /view/v1 mount --rbind / /view/v2 mount --rbind / /view/v3 mount --rbind / /view/v4}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj|ubh)}(hand if /usr has a versioning filesystem mounted, then that mount appears at /view/v1/usr, /view/v2/usr, /view/v3/usr and /view/v4/usr tooh]hand if /usr has a versioning filesystem mounted, then that mount appears at /view/v1/usr, /view/v2/usr, /view/v3/usr and /view/v4/usr too}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj|ubh)}(hA user can request v3 version of the file /usr/fs/namespace.c by accessing /view/v3/usr/fs/namespace.c . The underlying versioning filesystem can then decipher that v3 version of the filesystem is being requested and return the corresponding inode.h]hA user can request v3 version of the file /usr/fs/namespace.c by accessing /view/v3/usr/fs/namespace.c . The underlying versioning filesystem can then decipher that v3 version of the filesystem is being requested and return the corresponding inode.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj|ubeh}(h]h ]h"]h$]h&]uh1j;hhhKhjjubeh}(h]h ]h"]h$]h&]uh1jFhj7ubeh}(h]h ]h"]h$]h&]jjjhjjstartKuh1jAhj<ubeh}(h]h ]h"]h$]h&]uh1j;hhhKhj+hhubeh}(h] use-casesah ]h"] 4) use casesah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h5) Detailed semanticsh]h5) Detailed semantics}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubj<)}(hThe section below explains the detailed semantics of bind, rbind, move, mount, umount and clone-namespace operations. Note: the word 'vfsmount' and the noun 'mount' have been used to mean the same thing, throughout this document. h](h)}(huThe section below explains the detailed semantics of bind, rbind, move, mount, umount and clone-namespace operations.h]huThe section below explains the detailed semantics of bind, rbind, move, mount, umount and clone-namespace operations.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hoNote: the word 'vfsmount' and the noun 'mount' have been used to mean the same thing, throughout this document.h]hwNote: the word ‘vfsmount’ and the noun ‘mount’ have been used to mean the same thing, throughout this document.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j;hhhKhjhhubh)}(h5a) Mount statesh]h5a) Mount states}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj<)}(hX0A given mount can be in one of the following states 1) shared 2) slave 3) shared and slave 4) private 5) unbindable A 'propagation event' is defined as event generated on a vfsmount that leads to mount or unmount actions in other vfsmounts. A 'peer group' is defined as a group of vfsmounts that propagate events to each other. (1) Shared mounts A 'shared mount' is defined as a vfsmount that belongs to a 'peer group'. For example:: mount --make-shared /mnt mount --bind /mnt /tmp The mount at /mnt and that at /tmp are both shared and belong to the same peer group. Anything mounted or unmounted under /mnt or /tmp reflect in all the other mounts of its peer group. (2) Slave mounts A 'slave mount' is defined as a vfsmount that receives propagation events and does not forward propagation events. A slave mount as the name implies has a master mount from which mount/unmount events are received. Events do not propagate from the slave mount to the master. Only a shared mount can be made a slave by executing the following command:: mount --make-slave mount A shared mount that is made as a slave is no more shared unless modified to become shared. (3) Shared and Slave A vfsmount can be both shared as well as slave. This state indicates that the mount is a slave of some vfsmount, and has its own peer group too. This vfsmount receives propagation events from its master vfsmount, and also forwards propagation events to its 'peer group' and to its slave vfsmounts. Strictly speaking, the vfsmount is shared having its own peer group, and this peer-group is a slave of some other peer group. Only a slave vfsmount can be made as 'shared and slave' by either executing the following command:: mount --make-shared mount or by moving the slave vfsmount under a shared vfsmount. (4) Private mount A 'private mount' is defined as vfsmount that does not receive or forward any propagation events. (5) Unbindable mount A 'unbindable mount' is defined as vfsmount that does not receive or forward any propagation events and cannot be bind mounted. State diagram: The state diagram below explains the state transition of a mount, in response to various commands:: ----------------------------------------------------------------------- | |make-shared | make-slave | make-private |make-unbindab| --------------|------------|--------------|--------------|-------------| |shared |shared |*slave/private| private | unbindable | | | | | | | |-------------|------------|--------------|--------------|-------------| |slave |shared | **slave | private | unbindable | | |and slave | | | | |-------------|------------|--------------|--------------|-------------| |shared |shared | slave | private | unbindable | |and slave |and slave | | | | |-------------|------------|--------------|--------------|-------------| |private |shared | **private | private | unbindable | |-------------|------------|--------------|--------------|-------------| |unbindable |shared |**unbindable | private | unbindable | ------------------------------------------------------------------------ * if the shared mount is the only mount in its peer group, making it slave, makes it private automatically. Note that there is no master to which it can be slaved to. ** slaving a non-shared mount has no effect on the mount. Apart from the commands listed below, the 'move' operation also changes the state of a mount depending on type of the destination mount. Its explained in section 5d. h](h)}(h3A given mount can be in one of the following statesh]h3A given mount can be in one of the following states}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj,ubjB)}(hhh](jG)}(hsharedh]h)}(hjCh]hshared}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjAubah}(h]h ]h"]h$]h&]uh1jFhj>ubjG)}(hslaveh]h)}(hjZh]hslave}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjXubah}(h]h ]h"]h$]h&]uh1jFhj>ubjG)}(hshared and slaveh]h)}(hjqh]hshared and slave}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjoubah}(h]h ]h"]h$]h&]uh1jFhj>ubjG)}(hprivateh]h)}(hjh]hprivate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jFhj>ubjG)}(h unbindable h]h)}(h unbindableh]h unbindable}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jFhj>ubeh}(h]h ]h"]h$]h&]jarabicjhjjuh1jAhj,ubh)}(h|A 'propagation event' is defined as event generated on a vfsmount that leads to mount or unmount actions in other vfsmounts.h]hA ‘propagation event’ is defined as event generated on a vfsmount that leads to mount or unmount actions in other vfsmounts.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj,ubh)}(hVA 'peer group' is defined as a group of vfsmounts that propagate events to each other.h]hZA ‘peer group’ is defined as a group of vfsmounts that propagate events to each other.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj,ubjB)}(hhh](jG)}(hXShared mounts A 'shared mount' is defined as a vfsmount that belongs to a 'peer group'. For example:: mount --make-shared /mnt mount --bind /mnt /tmp The mount at /mnt and that at /tmp are both shared and belong to the same peer group. Anything mounted or unmounted under /mnt or /tmp reflect in all the other mounts of its peer group. h](h)}(h Shared mountsh]h Shared mounts}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj<)}(hXVA 'shared mount' is defined as a vfsmount that belongs to a 'peer group'. For example:: mount --make-shared /mnt mount --bind /mnt /tmp The mount at /mnt and that at /tmp are both shared and belong to the same peer group. Anything mounted or unmounted under /mnt or /tmp reflect in all the other mounts of its peer group. h](h)}(hIA 'shared mount' is defined as a vfsmount that belongs to a 'peer group'.h]hQA ‘shared mount’ is defined as a vfsmount that belongs to a ‘peer group’.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjubh)}(h For example::h]h For example:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjubj)}(h/mount --make-shared /mnt mount --bind /mnt /tmph]h/mount --make-shared /mnt mount --bind /mnt /tmp}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(hThe mount at /mnt and that at /tmp are both shared and belong to the same peer group. Anything mounted or unmounted under /mnt or /tmp reflect in all the other mounts of its peer group.h]hThe mount at /mnt and that at /tmp are both shared and belong to the same peer group. Anything mounted or unmounted under /mnt or /tmp reflect in all the other mounts of its peer group.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1j;hhhM hjubeh}(h]h ]h"]h$]h&]uh1jFhjubjG)}(hXSlave mounts A 'slave mount' is defined as a vfsmount that receives propagation events and does not forward propagation events. A slave mount as the name implies has a master mount from which mount/unmount events are received. Events do not propagate from the slave mount to the master. Only a shared mount can be made a slave by executing the following command:: mount --make-slave mount A shared mount that is made as a slave is no more shared unless modified to become shared. h](h)}(h Slave mountsh]h Slave mounts}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj5ubj<)}(hXA 'slave mount' is defined as a vfsmount that receives propagation events and does not forward propagation events. A slave mount as the name implies has a master mount from which mount/unmount events are received. Events do not propagate from the slave mount to the master. Only a shared mount can be made a slave by executing the following command:: mount --make-slave mount A shared mount that is made as a slave is no more shared unless modified to become shared. h](h)}(hrA 'slave mount' is defined as a vfsmount that receives propagation events and does not forward propagation events.h]hvA ‘slave mount’ is defined as a vfsmount that receives propagation events and does not forward propagation events.}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjGubh)}(hA slave mount as the name implies has a master mount from which mount/unmount events are received. Events do not propagate from the slave mount to the master. Only a shared mount can be made a slave by executing the following command::h]hA slave mount as the name implies has a master mount from which mount/unmount events are received. Events do not propagate from the slave mount to the master. Only a shared mount can be made a slave by executing the following command:}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjGubj)}(hmount --make-slave mounth]hmount --make-slave mount}hjgsbah}(h]h ]h"]h$]h&]hhuh1jhhhM"hjGubh)}(hZA shared mount that is made as a slave is no more shared unless modified to become shared.h]hZA shared mount that is made as a slave is no more shared unless modified to become shared.}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM$hjGubeh}(h]h ]h"]h$]h&]uh1j;hhhMhj5ubeh}(h]h ]h"]h$]h&]uh1jFhjubjG)}(hXShared and Slave A vfsmount can be both shared as well as slave. This state indicates that the mount is a slave of some vfsmount, and has its own peer group too. This vfsmount receives propagation events from its master vfsmount, and also forwards propagation events to its 'peer group' and to its slave vfsmounts. Strictly speaking, the vfsmount is shared having its own peer group, and this peer-group is a slave of some other peer group. Only a slave vfsmount can be made as 'shared and slave' by either executing the following command:: mount --make-shared mount or by moving the slave vfsmount under a shared vfsmount. h](h)}(hShared and Slaveh]hShared and Slave}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM'hjubj<)}(hXmA vfsmount can be both shared as well as slave. This state indicates that the mount is a slave of some vfsmount, and has its own peer group too. This vfsmount receives propagation events from its master vfsmount, and also forwards propagation events to its 'peer group' and to its slave vfsmounts. Strictly speaking, the vfsmount is shared having its own peer group, and this peer-group is a slave of some other peer group. Only a slave vfsmount can be made as 'shared and slave' by either executing the following command:: mount --make-shared mount or by moving the slave vfsmount under a shared vfsmount. h](h)}(hX+A vfsmount can be both shared as well as slave. This state indicates that the mount is a slave of some vfsmount, and has its own peer group too. This vfsmount receives propagation events from its master vfsmount, and also forwards propagation events to its 'peer group' and to its slave vfsmounts.h]hX/A vfsmount can be both shared as well as slave. This state indicates that the mount is a slave of some vfsmount, and has its own peer group too. This vfsmount receives propagation events from its master vfsmount, and also forwards propagation events to its ‘peer group’ and to its slave vfsmounts.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM)hjubh)}(h}Strictly speaking, the vfsmount is shared having its own peer group, and this peer-group is a slave of some other peer group.h]h}Strictly speaking, the vfsmount is shared having its own peer group, and this peer-group is a slave of some other peer group.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM/hjubh)}(hcOnly a slave vfsmount can be made as 'shared and slave' by either executing the following command::h]hfOnly a slave vfsmount can be made as ‘shared and slave’ by either executing the following command:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hjubj)}(hmount --make-shared mounth]hmount --make-shared mount}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM6hjubh)}(h8or by moving the slave vfsmount under a shared vfsmount.h]h8or by moving the slave vfsmount under a shared vfsmount.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM8hjubeh}(h]h ]h"]h$]h&]uh1j;hhhM)hjubeh}(h]h ]h"]h$]h&]uh1jFhjubjG)}(hyPrivate mount A 'private mount' is defined as vfsmount that does not receive or forward any propagation events. h](h)}(h Private mounth]h Private mount}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM:hjubj<)}(hbA 'private mount' is defined as vfsmount that does not receive or forward any propagation events. h]h)}(haA 'private mount' is defined as vfsmount that does not receive or forward any propagation events.h]heA ‘private mount’ is defined as vfsmount that does not receive or forward any propagation events.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM<hj ubah}(h]h ]h"]h$]h&]uh1j;hhhM<hjubeh}(h]h ]h"]h$]h&]uh1jFhjubjG)}(hUnbindable mount A 'unbindable mount' is defined as vfsmount that does not receive or forward any propagation events and cannot be bind mounted. h](h)}(hUnbindable mounth]hUnbindable mount}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM?hj'ubj<)}(hA 'unbindable mount' is defined as vfsmount that does not receive or forward any propagation events and cannot be bind mounted. h]h)}(hA 'unbindable mount' is defined as vfsmount that does not receive or forward any propagation events and cannot be bind mounted.h]hA ‘unbindable mount’ is defined as vfsmount that does not receive or forward any propagation events and cannot be bind mounted.}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhj9ubah}(h]h ]h"]h$]h&]uh1j;hhhMAhj'ubeh}(h]h ]h"]h$]h&]uh1jFhjubeh}(h]h ]h"]h$]h&]jjj(jjuh1jAhj,ubh)}(hState diagram:h]hState diagram:}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMFhj,ubh)}(hcThe state diagram below explains the state transition of a mount, in response to various commands::h]hbThe state diagram below explains the state transition of a mount, in response to various commands:}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMHhj,ubj)}(hXq----------------------------------------------------------------------- | |make-shared | make-slave | make-private |make-unbindab| --------------|------------|--------------|--------------|-------------| |shared |shared |*slave/private| private | unbindable | | | | | | | |-------------|------------|--------------|--------------|-------------| |slave |shared | **slave | private | unbindable | | |and slave | | | | |-------------|------------|--------------|--------------|-------------| |shared |shared | slave | private | unbindable | |and slave |and slave | | | | |-------------|------------|--------------|--------------|-------------| |private |shared | **private | private | unbindable | |-------------|------------|--------------|--------------|-------------| |unbindable |shared |**unbindable | private | unbindable | ------------------------------------------------------------------------ * if the shared mount is the only mount in its peer group, making it slave, makes it private automatically. Note that there is no master to which it can be slaved to. ** slaving a non-shared mount has no effect on the mount.h]hXq----------------------------------------------------------------------- | |make-shared | make-slave | make-private |make-unbindab| --------------|------------|--------------|--------------|-------------| |shared |shared |*slave/private| private | unbindable | | | | | | | |-------------|------------|--------------|--------------|-------------| |slave |shared | **slave | private | unbindable | | |and slave | | | | |-------------|------------|--------------|--------------|-------------| |shared |shared | slave | private | unbindable | |and slave |and slave | | | | |-------------|------------|--------------|--------------|-------------| |private |shared | **private | private | unbindable | |-------------|------------|--------------|--------------|-------------| |unbindable |shared |**unbindable | private | unbindable | ------------------------------------------------------------------------ * if the shared mount is the only mount in its peer group, making it slave, makes it private automatically. Note that there is no master to which it can be slaved to. ** slaving a non-shared mount has no effect on the mount.}hjzsbah}(h]h ]h"]h$]h&]hhuh1jhhhMKhj,ubh)}(hApart from the commands listed below, the 'move' operation also changes the state of a mount depending on type of the destination mount. Its explained in section 5d.h]hApart from the commands listed below, the ‘move’ operation also changes the state of a mount depending on type of the destination mount. Its explained in section 5d.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMbhj,ubeh}(h]h ]h"]h$]h&]uh1j;hhhKhjhhubh)}(h5b) Bind semanticsh]h5b) Bind semantics}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMfhjhhubj<)}(hX  Consider the following command:: mount --bind A/a B/b where 'A' is the source mount, 'a' is the dentry in the mount 'A', 'B' is the destination mount and 'b' is the dentry in the destination mount. The outcome depends on the type of mount of 'A' and 'B'. The table below contains quick reference:: -------------------------------------------------------------------------- | BIND MOUNT OPERATION | |************************************************************************| |source(A)->| shared | private | slave | unbindable | | dest(B) | | | | | | | | | | | | | v | | | | | |************************************************************************| | shared | shared | shared | shared & slave | invalid | | | | | | | |non-shared| shared | private | slave | invalid | ************************************************************************** Details: 1. 'A' is a shared mount and 'B' is a shared mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a' . 'C' is mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree containing 'C1',..,'Cn' is created. This propagation tree is identical to the propagation tree of 'B'. And finally the peer-group of 'C' is merged with the peer group of 'A'. 2. 'A' is a private mount and 'B' is a shared mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree is set containing all new mounts 'C', 'C1', .., 'Cn' with exactly the same configuration as the propagation tree for 'B'. 3. 'A' is a slave mount of mount 'Z' and 'B' is a shared mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a' . 'C' is mounted on mount 'B' at dentry 'b'. Also new mounts 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree containing the new mounts 'C','C1',.. 'Cn' is created. This propagation tree is identical to the propagation tree for 'B'. And finally the mount 'C' and its peer group is made the slave of mount 'Z'. In other words, mount 'C' is in the state 'slave and shared'. 4. 'A' is a unbindable mount and 'B' is a shared mount. This is a invalid operation. 5. 'A' is a private mount and 'B' is a non-shared(private or slave or unbindable) mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. 6. 'A' is a shared mount and 'B' is a non-shared mount. A new mount 'C' which is a clone of 'A' is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. 'C' is made a member of the peer-group of 'A'. 7. 'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. A new mount 'C' which is a clone of 'A' is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. Also 'C' is set as a slave mount of 'Z'. In other words 'A' and 'C' are both slave mounts of 'Z'. All mount/unmount events on 'Z' propagates to 'A' and 'C'. But mount/unmount on 'A' do not propagate anywhere else. Similarly mount/unmount on 'C' do not propagate anywhere else. 8. 'A' is a unbindable mount and 'B' is a non-shared mount. This is a invalid operation. A unbindable mount cannot be bind mounted. h](j<)}(hXConsider the following command:: mount --bind A/a B/b where 'A' is the source mount, 'a' is the dentry in the mount 'A', 'B' is the destination mount and 'b' is the dentry in the destination mount. The outcome depends on the type of mount of 'A' and 'B'. The table below contains quick reference:: -------------------------------------------------------------------------- | BIND MOUNT OPERATION | |************************************************************************| |source(A)->| shared | private | slave | unbindable | | dest(B) | | | | | | | | | | | | | v | | | | | |************************************************************************| | shared | shared | shared | shared & slave | invalid | | | | | | | |non-shared| shared | private | slave | invalid | ************************************************************************** Details: h](h)}(h Consider the following command::h]hConsider the following command:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhhjubj)}(hmount --bind A/a B/bh]hmount --bind A/a B/b}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMjhjubh)}(hwhere 'A' is the source mount, 'a' is the dentry in the mount 'A', 'B' is the destination mount and 'b' is the dentry in the destination mount.h]hwhere ‘A’ is the source mount, ‘a’ is the dentry in the mount ‘A’, ‘B’ is the destination mount and ‘b’ is the dentry in the destination mount.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMlhjubh)}(hcThe outcome depends on the type of mount of 'A' and 'B'. The table below contains quick reference::h]hjThe outcome depends on the type of mount of ‘A’ and ‘B’. The table below contains quick reference:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMohjubj)}(hX-------------------------------------------------------------------------- | BIND MOUNT OPERATION | |************************************************************************| |source(A)->| shared | private | slave | unbindable | | dest(B) | | | | | | | | | | | | | v | | | | | |************************************************************************| | shared | shared | shared | shared & slave | invalid | | | | | | | |non-shared| shared | private | slave | invalid | **************************************************************************h]hX-------------------------------------------------------------------------- | BIND MOUNT OPERATION | |************************************************************************| |source(A)->| shared | private | slave | unbindable | | dest(B) | | | | | | | | | | | | | v | | | | | |************************************************************************| | shared | shared | shared | shared & slave | invalid | | | | | | | |non-shared| shared | private | slave | invalid | **************************************************************************}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMrhjubh)}(hDetails:h]hDetails:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1j;hhhMhhjubjB)}(hhh](jG)}(hX'A' is a shared mount and 'B' is a shared mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a' . 'C' is mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree containing 'C1',..,'Cn' is created. This propagation tree is identical to the propagation tree of 'B'. And finally the peer-group of 'C' is merged with the peer group of 'A'. h]jk)}(hhh]jp)}(hX'A' is a shared mount and 'B' is a shared mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a' . 'C' is mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree containing 'C1',..,'Cn' is created. This propagation tree is identical to the propagation tree of 'B'. And finally the peer-group of 'C' is merged with the peer group of 'A'. h](jv)}(h@'A' is a shared mount and 'B' is a shared mount. A new mount 'C'h]hL‘A’ is a shared mount and ‘B’ is a shared mount. A new mount ‘C’}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj ubj)}(hhh]h)}(hXwhich is clone of 'A', is created. Its root dentry is 'a' . 'C' is mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree containing 'C1',..,'Cn' is created. This propagation tree is identical to the propagation tree of 'B'. And finally the peer-group of 'C' is merged with the peer group of 'A'.h]hXwhich is clone of ‘A’, is created. Its root dentry is ‘a’ . ‘C’ is mounted on mount ‘B’ at dentry ‘b’. Also new mount ‘C1’, ‘C2’, ‘C3’ ... are created and mounted at the dentry ‘b’ on all mounts where ‘B’ propagates to. A new propagation tree containing ‘C1’,..,’Cn’ is created. This propagation tree is identical to the propagation tree of ‘B’. And finally the peer-group of ‘C’ is merged with the peer group of ‘A’.}(hj+ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj( ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1johhhMhj ubah}(h]h ]h"]h$]h&]uh1jjhj ubah}(h]h ]h"]h$]h&]uh1jFhj ubjG)}(hX'A' is a private mount and 'B' is a shared mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree is set containing all new mounts 'C', 'C1', .., 'Cn' with exactly the same configuration as the propagation tree for 'B'. h]jk)}(hhh]jp)}(hX'A' is a private mount and 'B' is a shared mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree is set containing all new mounts 'C', 'C1', .., 'Cn' with exactly the same configuration as the propagation tree for 'B'. h](jv)}(hA'A' is a private mount and 'B' is a shared mount. A new mount 'C'h]hM‘A’ is a private mount and ‘B’ is a shared mount. A new mount ‘C’}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjX ubj)}(hhh]h)}(hXkwhich is clone of 'A', is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree is set containing all new mounts 'C', 'C1', .., 'Cn' with exactly the same configuration as the propagation tree for 'B'.h]hXwhich is clone of ‘A’, is created. Its root dentry is ‘a’. ‘C’ is mounted on mount ‘B’ at dentry ‘b’. Also new mount ‘C1’, ‘C2’, ‘C3’ ... are created and mounted at the dentry ‘b’ on all mounts where ‘B’ propagates to. A new propagation tree is set containing all new mounts ‘C’, ‘C1’, .., ‘Cn’ with exactly the same configuration as the propagation tree for ‘B’.}(hjm hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjj ubah}(h]h ]h"]h$]h&]uh1jhjX ubeh}(h]h ]h"]h$]h&]uh1johhhMhjU ubah}(h]h ]h"]h$]h&]uh1jjhjQ ubah}(h]h ]h"]h$]h&]uh1jFhj ubjG)}(hXQ'A' is a slave mount of mount 'Z' and 'B' is a shared mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a' . 'C' is mounted on mount 'B' at dentry 'b'. Also new mounts 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree containing the new mounts 'C','C1',.. 'Cn' is created. This propagation tree is identical to the propagation tree for 'B'. And finally the mount 'C' and its peer group is made the slave of mount 'Z'. In other words, mount 'C' is in the state 'slave and shared'. h]jk)}(hhh]jp)}(hXI'A' is a slave mount of mount 'Z' and 'B' is a shared mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a' . 'C' is mounted on mount 'B' at dentry 'b'. Also new mounts 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree containing the new mounts 'C','C1',.. 'Cn' is created. This propagation tree is identical to the propagation tree for 'B'. And finally the mount 'C' and its peer group is made the slave of mount 'Z'. In other words, mount 'C' is in the state 'slave and shared'. h](jv)}(hB'A' is a slave mount of mount 'Z' and 'B' is a shared mount. A newh]hN‘A’ is a slave mount of mount ‘Z’ and ‘B’ is a shared mount. A new}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj ubj)}(hhh]h)}(hXmount 'C' which is clone of 'A', is created. Its root dentry is 'a' . 'C' is mounted on mount 'B' at dentry 'b'. Also new mounts 'C1', 'C2', 'C3' ... are created and mounted at the dentry 'b' on all mounts where 'B' propagates to. A new propagation tree containing the new mounts 'C','C1',.. 'Cn' is created. This propagation tree is identical to the propagation tree for 'B'. And finally the mount 'C' and its peer group is made the slave of mount 'Z'. In other words, mount 'C' is in the state 'slave and shared'.h]hXQmount ‘C’ which is clone of ‘A’, is created. Its root dentry is ‘a’ . ‘C’ is mounted on mount ‘B’ at dentry ‘b’. Also new mounts ‘C1’, ‘C2’, ‘C3’ ... are created and mounted at the dentry ‘b’ on all mounts where ‘B’ propagates to. A new propagation tree containing the new mounts ‘C’,’C1’,.. ‘Cn’ is created. This propagation tree is identical to the propagation tree for ‘B’. And finally the mount ‘C’ and its peer group is made the slave of mount ‘Z’. In other words, mount ‘C’ is in the state ‘slave and shared’.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1johhhMhj ubah}(h]h ]h"]h$]h&]uh1jjhj ubah}(h]h ]h"]h$]h&]uh1jFhj ubjG)}(hS'A' is a unbindable mount and 'B' is a shared mount. This is a invalid operation. h]jk)}(hhh]jp)}(hR'A' is a unbindable mount and 'B' is a shared mount. This is a invalid operation. h](jv)}(h>'A' is a unbindable mount and 'B' is a shared mount. This is ah]hF‘A’ is a unbindable mount and ‘B’ is a shared mount. This is a}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj ubj)}(hhh]h)}(hinvalid operation.h]hinvalid operation.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1johhhMhj ubah}(h]h ]h"]h$]h&]uh1jjhj ubah}(h]h ]h"]h$]h&]uh1jFhj ubjG)}(h'A' is a private mount and 'B' is a non-shared(private or slave or unbindable) mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. h]jk)}(hhh]jp)}(h'A' is a private mount and 'B' is a non-shared(private or slave or unbindable) mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. h](jv)}(hB'A' is a private mount and 'B' is a non-shared(private or slave orh]hJ‘A’ is a private mount and ‘B’ is a non-shared(private or slave or}(hj" hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj ubj)}(hhh]h)}(hunbindable) mount. A new mount 'C' which is clone of 'A', is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'.h]hunbindable) mount. A new mount ‘C’ which is clone of ‘A’, is created. Its root dentry is ‘a’. ‘C’ is mounted on mount ‘B’ at dentry ‘b’.}(hj3 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj0 ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1johhhMhj ubah}(h]h ]h"]h$]h&]uh1jjhj ubah}(h]h ]h"]h$]h&]uh1jFhj ubjG)}(h'A' is a shared mount and 'B' is a non-shared mount. A new mount 'C' which is a clone of 'A' is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. 'C' is made a member of the peer-group of 'A'. h]jk)}(hhh]jp)}(h'A' is a shared mount and 'B' is a non-shared mount. A new mount 'C' which is a clone of 'A' is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. 'C' is made a member of the peer-group of 'A'. h](jv)}(hD'A' is a shared mount and 'B' is a non-shared mount. A new mount 'C'h]hP‘A’ is a shared mount and ‘B’ is a non-shared mount. A new mount ‘C’}(hjd hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj` ubj)}(hhh]h)}(hwhich is a clone of 'A' is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. 'C' is made a member of the peer-group of 'A'.h]hwhich is a clone of ‘A’ is created. Its root dentry is ‘a’. ‘C’ is mounted on mount ‘B’ at dentry ‘b’. ‘C’ is made a member of the peer-group of ‘A’.}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjr ubah}(h]h ]h"]h$]h&]uh1jhj` ubeh}(h]h ]h"]h$]h&]uh1johhhMhj] ubah}(h]h ]h"]h$]h&]uh1jjhjY ubah}(h]h ]h"]h$]h&]uh1jFhj ubjG)}(hX'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. A new mount 'C' which is a clone of 'A' is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. Also 'C' is set as a slave mount of 'Z'. In other words 'A' and 'C' are both slave mounts of 'Z'. All mount/unmount events on 'Z' propagates to 'A' and 'C'. But mount/unmount on 'A' do not propagate anywhere else. Similarly mount/unmount on 'C' do not propagate anywhere else. h]jk)}(hhh]jp)}(hX'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. A new mount 'C' which is a clone of 'A' is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. Also 'C' is set as a slave mount of 'Z'. In other words 'A' and 'C' are both slave mounts of 'Z'. All mount/unmount events on 'Z' propagates to 'A' and 'C'. But mount/unmount on 'A' do not propagate anywhere else. Similarly mount/unmount on 'C' do not propagate anywhere else. h](jv)}(hB'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. Ah]hN‘A’ is a slave mount of mount ‘Z’ and ‘B’ is a non-shared mount. A}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj ubj)}(hhh]h)}(hXnew mount 'C' which is a clone of 'A' is created. Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. Also 'C' is set as a slave mount of 'Z'. In other words 'A' and 'C' are both slave mounts of 'Z'. All mount/unmount events on 'Z' propagates to 'A' and 'C'. But mount/unmount on 'A' do not propagate anywhere else. Similarly mount/unmount on 'C' do not propagate anywhere else.h]hXnew mount ‘C’ which is a clone of ‘A’ is created. Its root dentry is ‘a’. ‘C’ is mounted on mount ‘B’ at dentry ‘b’. Also ‘C’ is set as a slave mount of ‘Z’. In other words ‘A’ and ‘C’ are both slave mounts of ‘Z’. All mount/unmount events on ‘Z’ propagates to ‘A’ and ‘C’. But mount/unmount on ‘A’ do not propagate anywhere else. Similarly mount/unmount on ‘C’ do not propagate anywhere else.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1johhhMhj ubah}(h]h ]h"]h$]h&]uh1jjhj ubah}(h]h ]h"]h$]h&]uh1jFhj ubjG)}(h'A' is a unbindable mount and 'B' is a non-shared mount. This is a invalid operation. A unbindable mount cannot be bind mounted. h]jk)}(hhh]jp)}(h'A' is a unbindable mount and 'B' is a non-shared mount. This is a invalid operation. A unbindable mount cannot be bind mounted. h](jv)}(hB'A' is a unbindable mount and 'B' is a non-shared mount. This is ah]hJ‘A’ is a unbindable mount and ‘B’ is a non-shared mount. This is a}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj ubj)}(hhh]h)}(h=invalid operation. A unbindable mount cannot be bind mounted.h]h=invalid operation. A unbindable mount cannot be bind mounted.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1johhhMhj ubah}(h]h ]h"]h$]h&]uh1jjhj ubah}(h]h ]h"]h$]h&]uh1jFhj ubeh}(h]h ]h"]h$]h&]jjjhjjuh1jAhjubeh}(h]h ]h"]h$]h&]uh1j;hhhMhhjhhubh)}(h5c) Rbind semanticsh]h5c) Rbind semantics}(hj+ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj<)}(hX"rbind is same as bind. Bind replicates the specified mount. Rbind replicates all the mounts in the tree belonging to the specified mount. Rbind mount is bind mount applied to all the mounts in the tree. If the source tree that is rbind has some unbindable mounts, then the subtree under the unbindable mount is pruned in the new location. eg: let's say we have the following mount tree:: A / \ B C / \ / \ D E F G Let's say all the mount except the mount C in the tree are of a type other than unbindable. If this tree is rbound to say Z We will have the following tree at the new location:: Z | A' / B' Note how the tree under C is pruned / \ in the new location. D' E' h](h)}(hrbind is same as bind. Bind replicates the specified mount. Rbind replicates all the mounts in the tree belonging to the specified mount. Rbind mount is bind mount applied to all the mounts in the tree.h]hrbind is same as bind. Bind replicates the specified mount. Rbind replicates all the mounts in the tree belonging to the specified mount. Rbind mount is bind mount applied to all the mounts in the tree.}(hj= hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj9 ubh)}(hIf the source tree that is rbind has some unbindable mounts, then the subtree under the unbindable mount is pruned in the new location.h]hIf the source tree that is rbind has some unbindable mounts, then the subtree under the unbindable mount is pruned in the new location.}(hjK hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj9 ubh)}(heg:h]heg:}(hjY hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj9 ubj<)}(hXlet's say we have the following mount tree:: A / \ B C / \ / \ D E F G Let's say all the mount except the mount C in the tree are of a type other than unbindable. If this tree is rbound to say Z We will have the following tree at the new location:: Z | A' / B' Note how the tree under C is pruned / \ in the new location. D' E' h](h)}(h,let's say we have the following mount tree::h]h-let’s say we have the following mount tree:}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjg ubj)}(h" A / \ B C / \ / \ D E F Gh]h" A / \ B C / \ / \ D E F G}hjy sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjg ubh)}(h[Let's say all the mount except the mount C in the tree are of a type other than unbindable.h]h]Let’s say all the mount except the mount C in the tree are of a type other than unbindable.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjg ubh)}(hIf this tree is rbound to say Zh]hIf this tree is rbound to say Z}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjg ubh)}(h5We will have the following tree at the new location::h]h4We will have the following tree at the new location:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjg ubj)}(h~ Z | A' / B' Note how the tree under C is pruned / \ in the new location. D' E'h]h~ Z | A' / B' Note how the tree under C is pruned / \ in the new location. D' E'}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjg ubeh}(h]h ]h"]h$]h&]uh1j;hhhMhj9 ubeh}(h]h ]h"]h$]h&]uh1j;hhhMhjhhubh)}(h5d) Move semanticsh]h5d) Move semantics}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj<)}(hXf Consider the following command mount --move A B/b where 'A' is the source mount, 'B' is the destination mount and 'b' is the dentry in the destination mount. The outcome depends on the type of the mount of 'A' and 'B'. The table below is a quick reference:: --------------------------------------------------------------------------- | MOVE MOUNT OPERATION | |************************************************************************** | source(A)->| shared | private | slave | unbindable | | dest(B) | | | | | | | | | | | | | v | | | | | |************************************************************************** | shared | shared | shared |shared and slave| invalid | | | | | | | |non-shared| shared | private | slave | unbindable | *************************************************************************** .. Note:: moving a mount residing under a shared mount is invalid. Details follow: 1. 'A' is a shared mount and 'B' is a shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mounts 'A1', 'A2'...'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. A new propagation tree is created in the exact same configuration as that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. And this new propagation tree is appended to the already existing propagation tree of 'A'. 2. 'A' is a private mount and 'B' is a shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mount 'A1', 'A2'... 'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. The mount 'A' becomes a shared mount and a propagation tree is created which is identical to that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. 3. 'A' is a slave mount of mount 'Z' and 'B' is a shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mounts 'A1', 'A2'... 'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. A new propagation tree is created in the exact same configuration as that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. And this new propagation tree is appended to the already existing propagation tree of 'A'. Mount 'A' continues to be the slave mount of 'Z' but it also becomes 'shared'. 4. 'A' is a unbindable mount and 'B' is a shared mount. The operation is invalid. Because mounting anything on the shared mount 'B' can create new mounts that get mounted on the mounts that receive propagation from 'B'. And since the mount 'A' is unbindable, cloning it to mount at other mountpoints is not possible. 5. 'A' is a private mount and 'B' is a non-shared(private or slave or unbindable) mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. 6. 'A' is a shared mount and 'B' is a non-shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a shared mount. 7. 'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a slave mount of mount 'Z'. 8. 'A' is a unbindable mount and 'B' is a non-shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a unbindable mount. h](j<)}(hXA Consider the following command mount --move A B/b where 'A' is the source mount, 'B' is the destination mount and 'b' is the dentry in the destination mount. The outcome depends on the type of the mount of 'A' and 'B'. The table below is a quick reference:: --------------------------------------------------------------------------- | MOVE MOUNT OPERATION | |************************************************************************** | source(A)->| shared | private | slave | unbindable | | dest(B) | | | | | | | | | | | | | v | | | | | |************************************************************************** | shared | shared | shared |shared and slave| invalid | | | | | | | |non-shared| shared | private | slave | unbindable | *************************************************************************** .. Note:: moving a mount residing under a shared mount is invalid. Details follow: h](j<)}(hX Consider the following command mount --move A B/b where 'A' is the source mount, 'B' is the destination mount and 'b' is the dentry in the destination mount. The outcome depends on the type of the mount of 'A' and 'B'. The table below is a quick reference:: --------------------------------------------------------------------------- | MOVE MOUNT OPERATION | |************************************************************************** | source(A)->| shared | private | slave | unbindable | | dest(B) | | | | | | | | | | | | | v | | | | | |************************************************************************** | shared | shared | shared |shared and slave| invalid | | | | | | | |non-shared| shared | private | slave | unbindable | *************************************************************************** .. Note:: moving a mount residing under a shared mount is invalid. h](h)}(hConsider the following commandh]hConsider the following command}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(hmount --move A B/bh]hmount --move A B/b}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(hkwhere 'A' is the source mount, 'B' is the destination mount and 'b' is the dentry in the destination mount.h]hwwhere ‘A’ is the source mount, ‘B’ is the destination mount and ‘b’ is the dentry in the destination mount.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(hcThe outcome depends on the type of the mount of 'A' and 'B'. The table below is a quick reference::h]hjThe outcome depends on the type of the mount of ‘A’ and ‘B’. The table below is a quick reference:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubj)}(hX--------------------------------------------------------------------------- | MOVE MOUNT OPERATION | |************************************************************************** | source(A)->| shared | private | slave | unbindable | | dest(B) | | | | | | | | | | | | | v | | | | | |************************************************************************** | shared | shared | shared |shared and slave| invalid | | | | | | | |non-shared| shared | private | slave | unbindable | ***************************************************************************h]hX--------------------------------------------------------------------------- | MOVE MOUNT OPERATION | |************************************************************************** | source(A)->| shared | private | slave | unbindable | | dest(B) | | | | | | | | | | | | | v | | | | | |************************************************************************** | shared | shared | shared |shared and slave| invalid | | | | | | | |non-shared| shared | private | slave | unbindable | ***************************************************************************}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj ubhnote)}(h8moving a mount residing under a shared mount is invalid.h]h)}(hj/ h]h8moving a mount residing under a shared mount is invalid.}(hj1 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj- ubah}(h]h ]h"]h$]h&]uh1j+ hj ubeh}(h]h ]h"]h$]h&]uh1j;hhhMhj ubh)}(hDetails follow:h]hDetails follow:}(hjJ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubeh}(h]h ]h"]h$]h&]uh1j;hhhMhj ubjB)}(hhh](jG)}(hX'A' is a shared mount and 'B' is a shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mounts 'A1', 'A2'...'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. A new propagation tree is created in the exact same configuration as that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. And this new propagation tree is appended to the already existing propagation tree of 'A'. h]jk)}(hhh]jp)}(hX'A' is a shared mount and 'B' is a shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mounts 'A1', 'A2'...'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. A new propagation tree is created in the exact same configuration as that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. And this new propagation tree is appended to the already existing propagation tree of 'A'. h](jv)}(hB'A' is a shared mount and 'B' is a shared mount. The mount 'A' ish]hN‘A’ is a shared mount and ‘B’ is a shared mount. The mount ‘A’ is}(hjl hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjh ubj)}(hhh]h)}(hXmounted on mount 'B' at dentry 'b'. Also new mounts 'A1', 'A2'...'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. A new propagation tree is created in the exact same configuration as that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. And this new propagation tree is appended to the already existing propagation tree of 'A'.h]hXmounted on mount ‘B’ at dentry ‘b’. Also new mounts ‘A1’, ‘A2’...’An’ are created and mounted at dentry ‘b’ on all mounts that receive propagation from mount ‘B’. A new propagation tree is created in the exact same configuration as that of ‘B’. This new propagation tree contains all the new mounts ‘A1’, ‘A2’... ‘An’. And this new propagation tree is appended to the already existing propagation tree of ‘A’.}(hj} hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjz ubah}(h]h ]h"]h$]h&]uh1jhjh ubeh}(h]h ]h"]h$]h&]uh1johhhMhje ubah}(h]h ]h"]h$]h&]uh1jjhja ubah}(h]h ]h"]h$]h&]uh1jFhj^ ubjG)}(hX'A' is a private mount and 'B' is a shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mount 'A1', 'A2'... 'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. The mount 'A' becomes a shared mount and a propagation tree is created which is identical to that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. h]jk)}(hhh]jp)}(hX'A' is a private mount and 'B' is a shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mount 'A1', 'A2'... 'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. The mount 'A' becomes a shared mount and a propagation tree is created which is identical to that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. h](jv)}(hB'A' is a private mount and 'B' is a shared mount. The mount 'A' ish]hN‘A’ is a private mount and ‘B’ is a shared mount. The mount ‘A’ is}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj ubj)}(hhh]h)}(hXWmounted on mount 'B' at dentry 'b'. Also new mount 'A1', 'A2'... 'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. The mount 'A' becomes a shared mount and a propagation tree is created which is identical to that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'.h]hXmounted on mount ‘B’ at dentry ‘b’. Also new mount ‘A1’, ‘A2’... ‘An’ are created and mounted at dentry ‘b’ on all mounts that receive propagation from mount ‘B’. The mount ‘A’ becomes a shared mount and a propagation tree is created which is identical to that of ‘B’. This new propagation tree contains all the new mounts ‘A1’, ‘A2’... ‘An’.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1johhhMhj ubah}(h]h ]h"]h$]h&]uh1jjhj ubah}(h]h ]h"]h$]h&]uh1jFhj^ ubjG)}(hXE'A' is a slave mount of mount 'Z' and 'B' is a shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mounts 'A1', 'A2'... 'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. A new propagation tree is created in the exact same configuration as that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. And this new propagation tree is appended to the already existing propagation tree of 'A'. Mount 'A' continues to be the slave mount of 'Z' but it also becomes 'shared'. h]jk)}(hhh]jp)}(hX='A' is a slave mount of mount 'Z' and 'B' is a shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mounts 'A1', 'A2'... 'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. A new propagation tree is created in the exact same configuration as that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. And this new propagation tree is appended to the already existing propagation tree of 'A'. Mount 'A' continues to be the slave mount of 'Z' but it also becomes 'shared'. h](jv)}(hA'A' is a slave mount of mount 'Z' and 'B' is a shared mount. Theh]hM‘A’ is a slave mount of mount ‘Z’ and ‘B’ is a shared mount. The}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj ubj)}(hhh]h)}(hXmount 'A' is mounted on mount 'B' at dentry 'b'. Also new mounts 'A1', 'A2'... 'An' are created and mounted at dentry 'b' on all mounts that receive propagation from mount 'B'. A new propagation tree is created in the exact same configuration as that of 'B'. This new propagation tree contains all the new mounts 'A1', 'A2'... 'An'. And this new propagation tree is appended to the already existing propagation tree of 'A'. Mount 'A' continues to be the slave mount of 'Z' but it also becomes 'shared'.h]hX:mount ‘A’ is mounted on mount ‘B’ at dentry ‘b’. Also new mounts ‘A1’, ‘A2’... ‘An’ are created and mounted at dentry ‘b’ on all mounts that receive propagation from mount ‘B’. A new propagation tree is created in the exact same configuration as that of ‘B’. This new propagation tree contains all the new mounts ‘A1’, ‘A2’... ‘An’. And this new propagation tree is appended to the already existing propagation tree of ‘A’. Mount ‘A’ continues to be the slave mount of ‘Z’ but it also becomes ‘shared’.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1johhhMhj ubah}(h]h ]h"]h$]h&]uh1jjhj ubah}(h]h ]h"]h$]h&]uh1jFhj^ ubjG)}(hX?'A' is a unbindable mount and 'B' is a shared mount. The operation is invalid. Because mounting anything on the shared mount 'B' can create new mounts that get mounted on the mounts that receive propagation from 'B'. And since the mount 'A' is unbindable, cloning it to mount at other mountpoints is not possible. h]jk)}(hhh]jp)}(hX;'A' is a unbindable mount and 'B' is a shared mount. The operation is invalid. Because mounting anything on the shared mount 'B' can create new mounts that get mounted on the mounts that receive propagation from 'B'. And since the mount 'A' is unbindable, cloning it to mount at other mountpoints is not possible. h](jv)}(hB'A' is a unbindable mount and 'B' is a shared mount. The operationh]hJ‘A’ is a unbindable mount and ‘B’ is a shared mount. The operation}(hj2 hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj. ubj)}(hhh]h)}(his invalid. Because mounting anything on the shared mount 'B' can create new mounts that get mounted on the mounts that receive propagation from 'B'. And since the mount 'A' is unbindable, cloning it to mount at other mountpoints is not possible.h]hXis invalid. Because mounting anything on the shared mount ‘B’ can create new mounts that get mounted on the mounts that receive propagation from ‘B’. And since the mount ‘A’ is unbindable, cloning it to mount at other mountpoints is not possible.}(hjC hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj@ ubah}(h]h ]h"]h$]h&]uh1jhj. ubeh}(h]h ]h"]h$]h&]uh1johhhMhj+ ubah}(h]h ]h"]h$]h&]uh1jjhj' ubah}(h]h ]h"]h$]h&]uh1jFhj^ ubjG)}(h'A' is a private mount and 'B' is a non-shared(private or slave or unbindable) mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. h]jk)}(hhh]jp)}(h'A' is a private mount and 'B' is a non-shared(private or slave or unbindable) mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. h](jv)}(hB'A' is a private mount and 'B' is a non-shared(private or slave orh]hJ‘A’ is a private mount and ‘B’ is a non-shared(private or slave or}(hjt hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjp ubj)}(hhh]h)}(hGunbindable) mount. The mount 'A' is mounted on mount 'B' at dentry 'b'.h]hSunbindable) mount. The mount ‘A’ is mounted on mount ‘B’ at dentry ‘b’.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhjp ubeh}(h]h ]h"]h$]h&]uh1johhhMhjm ubah}(h]h ]h"]h$]h&]uh1jjhji ubah}(h]h ]h"]h$]h&]uh1jFhj^ ubjG)}(h'A' is a shared mount and 'B' is a non-shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a shared mount. h]jk)}(hhh]jp)}(h'A' is a shared mount and 'B' is a non-shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a shared mount. h](jv)}(hC'A' is a shared mount and 'B' is a non-shared mount. The mount 'A'h]hO‘A’ is a shared mount and ‘B’ is a non-shared mount. The mount ‘A’}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj ubj)}(hhh]h)}(hQis mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a shared mount.h]h]is mounted on mount ‘B’ at dentry ‘b’. Mount ‘A’ continues to be a shared mount.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1johhhMhj ubah}(h]h ]h"]h$]h&]uh1jjhj ubah}(h]h ]h"]h$]h&]uh1jFhj^ ubjG)}(h'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a slave mount of mount 'Z'. h]jk)}(hhh]jp)}(h'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a slave mount of mount 'Z'. h](jv)}(h@'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount.h]hL‘A’ is a slave mount of mount ‘Z’ and ‘B’ is a non-shared mount.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhj ubj)}(hhh]h)}(hkThe mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a slave mount of mount 'Z'.h]hThe mount ‘A’ is mounted on mount ‘B’ at dentry ‘b’. Mount ‘A’ continues to be a slave mount of mount ‘Z’.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1johhhMhj ubah}(h]h ]h"]h$]h&]uh1jjhj ubah}(h]h ]h"]h$]h&]uh1jFhj^ ubjG)}(h'A' is a unbindable mount and 'B' is a non-shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a unbindable mount. h]jk)}(hhh]jp)}(h'A' is a unbindable mount and 'B' is a non-shared mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a unbindable mount. h](jv)}(hB'A' is a unbindable mount and 'B' is a non-shared mount. The mounth]hJ‘A’ is a unbindable mount and ‘B’ is a non-shared mount. The mount}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhM#hj6ubj)}(hhh]h)}(hX'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a unbindable mount.h]hh‘A’ is mounted on mount ‘B’ at dentry ‘b’. Mount ‘A’ continues to be a unbindable mount.}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM"hjHubah}(h]h ]h"]h$]h&]uh1jhj6ubeh}(h]h ]h"]h$]h&]uh1johhhM#hj3ubah}(h]h ]h"]h$]h&]uh1jjhj/ubah}(h]h ]h"]h$]h&]uh1jFhj^ ubeh}(h]h ]h"]h$]h&]jjjhjjuh1jAhj ubeh}(h]h ]h"]h$]h&]uh1j;hhhMhjhhubh)}(h5e) Mount semanticsh]h5e) Mount semantics}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM%hjhhubj<)}(hConsider the following command:: mount device B/b 'B' is the destination mount and 'b' is the dentry in the destination mount. The above operation is the same as bind operation with the exception that the source mount is always a private mount. h](h)}(h Consider the following command::h]hConsider the following command:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM'hjubj)}(hmount device B/bh]hmount device B/b}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM)hjubh)}(hL'B' is the destination mount and 'b' is the dentry in the destination mount.h]hT‘B’ is the destination mount and ‘b’ is the dentry in the destination mount.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM+hjubh)}(huThe above operation is the same as bind operation with the exception that the source mount is always a private mount.h]huThe above operation is the same as bind operation with the exception that the source mount is always a private mount.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hjubeh}(h]h ]h"]h$]h&]uh1j;hhhM'hjhhubh)}(h5f) Unmount semanticsh]h5f) Unmount semantics}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM2hjhhubj<)}(hXlConsider the following command:: umount A where 'A' is a mount mounted on mount 'B' at dentry 'b'. If mount 'B' is shared, then all most-recently-mounted mounts at dentry 'b' on mounts that receive propagation from mount 'B' and does not have sub-mounts within them are unmounted. Example: Let's say 'B1', 'B2', 'B3' are shared mounts that propagate to each other. let's say 'A1', 'A2', 'A3' are first mounted at dentry 'b' on mount 'B1', 'B2' and 'B3' respectively. let's say 'C1', 'C2', 'C3' are next mounted at the same dentry 'b' on mount 'B1', 'B2' and 'B3' respectively. if 'C1' is unmounted, all the mounts that are most-recently-mounted on 'B1' and on the mounts that 'B1' propagates-to are unmounted. 'B1' propagates to 'B2' and 'B3'. And the most recently mounted mount on 'B2' at dentry 'b' is 'C2', and that of mount 'B3' is 'C3'. So all 'C1', 'C2' and 'C3' should be unmounted. If any of 'C2' or 'C3' has some child mounts, then that mount is not unmounted, but all other mounts are unmounted. However if 'C1' is told to be unmounted and 'C1' has some sub-mounts, the umount operation is failed entirely. h](h)}(h Consider the following command::h]hConsider the following command:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hjubj)}(humount Ah]humount A}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM6hjubh)}(h8where 'A' is a mount mounted on mount 'B' at dentry 'b'.h]hDwhere ‘A’ is a mount mounted on mount ‘B’ at dentry ‘b’.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM8hjubh)}(hIf mount 'B' is shared, then all most-recently-mounted mounts at dentry 'b' on mounts that receive propagation from mount 'B' and does not have sub-mounts within them are unmounted.h]hIf mount ‘B’ is shared, then all most-recently-mounted mounts at dentry ‘b’ on mounts that receive propagation from mount ‘B’ and does not have sub-mounts within them are unmounted.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM:hjubh)}(hSExample: Let's say 'B1', 'B2', 'B3' are shared mounts that propagate to each other.h]haExample: Let’s say ‘B1’, ‘B2’, ‘B3’ are shared mounts that propagate to each other.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM>hjubh)}(helet's say 'A1', 'A2', 'A3' are first mounted at dentry 'b' on mount 'B1', 'B2' and 'B3' respectively.h]hlet’s say ‘A1’, ‘A2’, ‘A3’ are first mounted at dentry ‘b’ on mount ‘B1’, ‘B2’ and ‘B3’ respectively.}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhjubh)}(hmlet's say 'C1', 'C2', 'C3' are next mounted at the same dentry 'b' on mount 'B1', 'B2' and 'B3' respectively.h]hlet’s say ‘C1’, ‘C2’, ‘C3’ are next mounted at the same dentry ‘b’ on mount ‘B1’, ‘B2’ and ‘B3’ respectively.}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMDhjubh)}(hif 'C1' is unmounted, all the mounts that are most-recently-mounted on 'B1' and on the mounts that 'B1' propagates-to are unmounted.h]hif ‘C1’ is unmounted, all the mounts that are most-recently-mounted on ‘B1’ and on the mounts that ‘B1’ propagates-to are unmounted.}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMGhjubh)}(h'B1' propagates to 'B2' and 'B3'. And the most recently mounted mount on 'B2' at dentry 'b' is 'C2', and that of mount 'B3' is 'C3'.h]h‘B1’ propagates to ‘B2’ and ‘B3’. And the most recently mounted mount on ‘B2’ at dentry ‘b’ is ‘C2’, and that of mount ‘B3’ is ‘C3’.}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhjubh)}(h/So all 'C1', 'C2' and 'C3' should be unmounted.h]h;So all ‘C1’, ‘C2’ and ‘C3’ should be unmounted.}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMMhjubh)}(hIf any of 'C2' or 'C3' has some child mounts, then that mount is not unmounted, but all other mounts are unmounted. However if 'C1' is told to be unmounted and 'C1' has some sub-mounts, the umount operation is failed entirely.h]hIf any of ‘C2’ or ‘C3’ has some child mounts, then that mount is not unmounted, but all other mounts are unmounted. However if ‘C1’ is told to be unmounted and ‘C1’ has some sub-mounts, the umount operation is failed entirely.}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMOhjubeh}(h]h ]h"]h$]h&]uh1j;hhhM4hjhhubh)}(h5g) Clone Namespaceh]h5g) Clone Namespace}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMThjhhubj<)}(hXA cloned namespace contains all the mounts as that of the parent namespace. Let's say 'A' and 'B' are the corresponding mounts in the parent and the child namespace. If 'A' is shared, then 'B' is also shared and 'A' and 'B' propagate to each other. If 'A' is a slave mount of 'Z', then 'B' is also the slave mount of 'Z'. If 'A' is a private mount, then 'B' is a private mount too. If 'A' is unbindable mount, then 'B' is a unbindable mount too. h](h)}(hKA cloned namespace contains all the mounts as that of the parent namespace.h]hKA cloned namespace contains all the mounts as that of the parent namespace.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMVhjubh)}(hYLet's say 'A' and 'B' are the corresponding mounts in the parent and the child namespace.h]hcLet’s say ‘A’ and ‘B’ are the corresponding mounts in the parent and the child namespace.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMYhjubh)}(hRIf 'A' is shared, then 'B' is also shared and 'A' and 'B' propagate to each other.h]hbIf ‘A’ is shared, then ‘B’ is also shared and ‘A’ and ‘B’ propagate to each other.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM\hjubh)}(hHIf 'A' is a slave mount of 'Z', then 'B' is also the slave mount of 'Z'.h]hXIf ‘A’ is a slave mount of ‘Z’, then ‘B’ is also the slave mount of ‘Z’.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM_hjubh)}(h;If 'A' is a private mount, then 'B' is a private mount too.h]hCIf ‘A’ is a private mount, then ‘B’ is a private mount too.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMbhjubh)}(h?If 'A' is unbindable mount, then 'B' is a unbindable mount too.h]hGIf ‘A’ is unbindable mount, then ‘B’ is a unbindable mount too.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMdhjubeh}(h]h ]h"]h$]h&]uh1j;hhhMVhjhhubeh}(h]detailed-semanticsah ]h"]5) detailed semanticsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h6) Quizh]h6) Quiz}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMhubj<)}(hXNA. What is the result of the following command sequence? :: mount --bind /mnt /mnt mount --make-shared /mnt mount --bind /mnt /tmp mount --move /tmp /mnt/1 what should be the contents of /mnt /mnt/1 /mnt/1/1 should be? Should they all be identical? or should /mnt and /mnt/1 be identical only? B. What is the result of the following command sequence? :: mount --make-rshared / mkdir -p /v/1 mount --rbind / /v/1 what should be the content of /v/1/v/1 be? C. What is the result of the following command sequence? :: mount --bind /mnt /mnt mount --make-shared /mnt mkdir -p /mnt/1/2/3 /mnt/1/test mount --bind /mnt/1 /tmp mount --make-slave /mnt mount --make-shared /mnt mount --bind /mnt/1/2 /tmp1 mount --make-slave /mnt At this point we have the first mount at /tmp and its root dentry is 1. Let's call this mount 'A' And then we have a second mount at /tmp1 with root dentry 2. Let's call this mount 'B' Next we have a third mount at /mnt with root dentry mnt. Let's call this mount 'C' 'B' is the slave of 'A' and 'C' is a slave of 'B' A -> B -> C at this point if we execute the following command mount --bind /bin /tmp/test The mount is attempted on 'A' will the mount propagate to 'B' and 'C' ? what would be the contents of /mnt/1/test be? h]jB)}(hhh](jG)}(hX_What is the result of the following command sequence? :: mount --bind /mnt /mnt mount --make-shared /mnt mount --bind /mnt /tmp mount --move /tmp /mnt/1 what should be the contents of /mnt /mnt/1 /mnt/1/1 should be? Should they all be identical? or should /mnt and /mnt/1 be identical only? h](h)}(h5What is the result of the following command sequence?h]h5What is the result of the following command sequence?}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMjhj ubj<)}(hX:: mount --bind /mnt /mnt mount --make-shared /mnt mount --bind /mnt /tmp mount --move /tmp /mnt/1 what should be the contents of /mnt /mnt/1 /mnt/1/1 should be? Should they all be identical? or should /mnt and /mnt/1 be identical only? h](j)}(h_mount --bind /mnt /mnt mount --make-shared /mnt mount --bind /mnt /tmp mount --move /tmp /mnt/1h]h_mount --bind /mnt /mnt mount --make-shared /mnt mount --bind /mnt /tmp mount --move /tmp /mnt/1}hj!sbah}(h]h ]h"]h$]h&]hhuh1jhhhMnhjubh)}(hwhat should be the contents of /mnt /mnt/1 /mnt/1/1 should be? Should they all be identical? or should /mnt and /mnt/1 be identical only?h]hwhat should be the contents of /mnt /mnt/1 /mnt/1/1 should be? Should they all be identical? or should /mnt and /mnt/1 be identical only?}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMshjubeh}(h]h ]h"]h$]h&]uh1j;hhhMlhj ubeh}(h]h ]h"]h$]h&]uh1jFhjubjG)}(hWhat is the result of the following command sequence? :: mount --make-rshared / mkdir -p /v/1 mount --rbind / /v/1 what should be the content of /v/1/v/1 be? h](h)}(h5What is the result of the following command sequence?h]h5What is the result of the following command sequence?}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMxhjIubj<)}(hw:: mount --make-rshared / mkdir -p /v/1 mount --rbind / /v/1 what should be the content of /v/1/v/1 be? h](j)}(h9mount --make-rshared / mkdir -p /v/1 mount --rbind / /v/1h]h9mount --make-rshared / mkdir -p /v/1 mount --rbind / /v/1}hj_sbah}(h]h ]h"]h$]h&]hhuh1jhhhM|hj[ubh)}(h*what should be the content of /v/1/v/1 be?h]h*what should be the content of /v/1/v/1 be?}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj[ubeh}(h]h ]h"]h$]h&]uh1j;hhhMzhjIubeh}(h]h ]h"]h$]h&]uh1jFhjubjG)}(hXWhat is the result of the following command sequence? :: mount --bind /mnt /mnt mount --make-shared /mnt mkdir -p /mnt/1/2/3 /mnt/1/test mount --bind /mnt/1 /tmp mount --make-slave /mnt mount --make-shared /mnt mount --bind /mnt/1/2 /tmp1 mount --make-slave /mnt At this point we have the first mount at /tmp and its root dentry is 1. Let's call this mount 'A' And then we have a second mount at /tmp1 with root dentry 2. Let's call this mount 'B' Next we have a third mount at /mnt with root dentry mnt. Let's call this mount 'C' 'B' is the slave of 'A' and 'C' is a slave of 'B' A -> B -> C at this point if we execute the following command mount --bind /bin /tmp/test The mount is attempted on 'A' will the mount propagate to 'B' and 'C' ? what would be the contents of /mnt/1/test be? h](h)}(h5What is the result of the following command sequence?h]h5What is the result of the following command sequence?}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj<)}(hX:: mount --bind /mnt /mnt mount --make-shared /mnt mkdir -p /mnt/1/2/3 /mnt/1/test mount --bind /mnt/1 /tmp mount --make-slave /mnt mount --make-shared /mnt mount --bind /mnt/1/2 /tmp1 mount --make-slave /mnt At this point we have the first mount at /tmp and its root dentry is 1. Let's call this mount 'A' And then we have a second mount at /tmp1 with root dentry 2. Let's call this mount 'B' Next we have a third mount at /mnt with root dentry mnt. Let's call this mount 'C' 'B' is the slave of 'A' and 'C' is a slave of 'B' A -> B -> C at this point if we execute the following command mount --bind /bin /tmp/test The mount is attempted on 'A' will the mount propagate to 'B' and 'C' ? what would be the contents of /mnt/1/test be? h](j)}(hmount --bind /mnt /mnt mount --make-shared /mnt mkdir -p /mnt/1/2/3 /mnt/1/test mount --bind /mnt/1 /tmp mount --make-slave /mnt mount --make-shared /mnt mount --bind /mnt/1/2 /tmp1 mount --make-slave /mnth]hmount --bind /mnt /mnt mount --make-shared /mnt mkdir -p /mnt/1/2/3 /mnt/1/test mount --bind /mnt/1 /tmp mount --make-slave /mnt mount --make-shared /mnt mount --bind /mnt/1/2 /tmp1 mount --make-slave /mnt}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(hX At this point we have the first mount at /tmp and its root dentry is 1. Let's call this mount 'A' And then we have a second mount at /tmp1 with root dentry 2. Let's call this mount 'B' Next we have a third mount at /mnt with root dentry mnt. Let's call this mount 'C'h]hXAt this point we have the first mount at /tmp and its root dentry is 1. Let’s call this mount ‘A’ And then we have a second mount at /tmp1 with root dentry 2. Let’s call this mount ‘B’ Next we have a third mount at /mnt with root dentry mnt. Let’s call this mount ‘C’}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(h='B' is the slave of 'A' and 'C' is a slave of 'B' A -> B -> Ch]hM‘B’ is the slave of ‘A’ and ‘C’ is a slave of ‘B’ A -> B -> C}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(h1at this point if we execute the following commandh]h1at this point if we execute the following command}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hmount --bind /bin /tmp/testh]hmount --bind /bin /tmp/test}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hThe mount is attempted on 'A'h]h!The mount is attempted on ‘A’}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(h)will the mount propagate to 'B' and 'C' ?h]h1will the mount propagate to ‘B’ and ‘C’ ?}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(h-what would be the contents of /mnt/1/test be?h]h-what would be the contents of /mnt/1/test be?}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1j;hhhMhjubeh}(h]h ]h"]h$]h&]uh1jFhjubeh}(h]h ]h"]h$]h&]jjjhjjuh1jAhjubah}(h]h ]h"]h$]h&]uh1j;hhhMjhjhhubeh}(h]quizah ]h"]6) quizah$]h&]uh1hhhhhhhhMhubh)}(hhh](h)}(h7) FAQh]h7) FAQ}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj-hhhhhMubj<)}(hXQ1. Why is bind mount needed? How is it different from symbolic links? symbolic links can get stale if the destination mount gets unmounted or moved. Bind mounts continue to exist even if the other mount is unmounted or moved. Q2. Why can't the shared subtree be implemented using exportfs? exportfs is a heavyweight way of accomplishing part of what shared subtree can do. I cannot imagine a way to implement the semantics of slave mount using exportfs? Q3 Why is unbindable mount needed? Let's say we want to replicate the mount tree at multiple locations within the same subtree. if one rbind mounts a tree within the same subtree 'n' times the number of mounts created is an exponential function of 'n'. Having unbindable mount can help prune the unneeded bind mounts. Here is an example. step 1: let's say the root tree has just two directories with one vfsmount:: root / \ tmp usr And we want to replicate the tree at multiple mountpoints under /root/tmp step 2: :: mount --make-shared /root mkdir -p /tmp/m1 mount --rbind /root /tmp/m1 the new tree now looks like this:: root / \ tmp usr / m1 / \ tmp usr / m1 it has two vfsmounts step 3: :: mkdir -p /tmp/m2 mount --rbind /root /tmp/m2 the new tree now looks like this:: root / \ tmp usr / \ m1 m2 / \ / \ tmp usr tmp usr / \ / m1 m2 m1 / \ / \ tmp usr tmp usr / / \ m1 m1 m2 / \ tmp usr / \ m1 m2 it has 6 vfsmounts step 4: :: mkdir -p /tmp/m3 mount --rbind /root /tmp/m3 I won't draw the tree..but it has 24 vfsmounts at step i the number of vfsmounts is V[i] = i*V[i-1]. This is an exponential function. And this tree has way more mounts than what we really needed in the first place. One could use a series of umount at each step to prune out the unneeded mounts. But there is a better solution. Unclonable mounts come in handy here. step 1: let's say the root tree has just two directories with one vfsmount:: root / \ tmp usr How do we set up the same tree at multiple locations under /root/tmp step 2: :: mount --bind /root/tmp /root/tmp mount --make-rshared /root mount --make-unbindable /root/tmp mkdir -p /tmp/m1 mount --rbind /root /tmp/m1 the new tree now looks like this:: root / \ tmp usr / m1 / \ tmp usr step 3: :: mkdir -p /tmp/m2 mount --rbind /root /tmp/m2 the new tree now looks like this:: root / \ tmp usr / \ m1 m2 / \ / \ tmp usr tmp usr step 4: :: mkdir -p /tmp/m3 mount --rbind /root /tmp/m3 the new tree now looks like this:: root / \ tmp usr / \ \ m1 m2 m3 / \ / \ / \ tmp usr tmp usr tmp usr h](jk)}(hhh]jp)}(hQ1. Why is bind mount needed? How is it different from symbolic links? symbolic links can get stale if the destination mount gets unmounted or moved. Bind mounts continue to exist even if the other mount is unmounted or moved. h](jv)}(hFQ1. Why is bind mount needed? How is it different from symbolic links?h]hFQ1. Why is bind mount needed? How is it different from symbolic links?}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjEubj)}(hhh]h)}(hsymbolic links can get stale if the destination mount gets unmounted or moved. Bind mounts continue to exist even if the other mount is unmounted or moved.h]hsymbolic links can get stale if the destination mount gets unmounted or moved. Bind mounts continue to exist even if the other mount is unmounted or moved.}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjWubah}(h]h ]h"]h$]h&]uh1jhjEubeh}(h]h ]h"]h$]h&]uh1johhhMhjBubah}(h]h ]h"]h$]h&]uh1jjhj>ubh)}(h?Q2. Why can't the shared subtree be implemented using exportfs?h]hAQ2. Why can’t the shared subtree be implemented using exportfs?}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj>ubj<)}(hexportfs is a heavyweight way of accomplishing part of what shared subtree can do. I cannot imagine a way to implement the semantics of slave mount using exportfs? h]h)}(hexportfs is a heavyweight way of accomplishing part of what shared subtree can do. I cannot imagine a way to implement the semantics of slave mount using exportfs?h]hexportfs is a heavyweight way of accomplishing part of what shared subtree can do. I cannot imagine a way to implement the semantics of slave mount using exportfs?}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j;hhhMhj>ubh)}(h"Q3 Why is unbindable mount needed?h]h"Q3 Why is unbindable mount needed?}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj>ubj<)}(hX Let's say we want to replicate the mount tree at multiple locations within the same subtree. if one rbind mounts a tree within the same subtree 'n' times the number of mounts created is an exponential function of 'n'. Having unbindable mount can help prune the unneeded bind mounts. Here is an example. step 1: let's say the root tree has just two directories with one vfsmount:: root / \ tmp usr And we want to replicate the tree at multiple mountpoints under /root/tmp step 2: :: mount --make-shared /root mkdir -p /tmp/m1 mount --rbind /root /tmp/m1 the new tree now looks like this:: root / \ tmp usr / m1 / \ tmp usr / m1 it has two vfsmounts step 3: :: mkdir -p /tmp/m2 mount --rbind /root /tmp/m2 the new tree now looks like this:: root / \ tmp usr / \ m1 m2 / \ / \ tmp usr tmp usr / \ / m1 m2 m1 / \ / \ tmp usr tmp usr / / \ m1 m1 m2 / \ tmp usr / \ m1 m2 it has 6 vfsmounts step 4: :: mkdir -p /tmp/m3 mount --rbind /root /tmp/m3 I won't draw the tree..but it has 24 vfsmounts at step i the number of vfsmounts is V[i] = i*V[i-1]. This is an exponential function. And this tree has way more mounts than what we really needed in the first place. One could use a series of umount at each step to prune out the unneeded mounts. But there is a better solution. Unclonable mounts come in handy here. step 1: let's say the root tree has just two directories with one vfsmount:: root / \ tmp usr How do we set up the same tree at multiple locations under /root/tmp step 2: :: mount --bind /root/tmp /root/tmp mount --make-rshared /root mount --make-unbindable /root/tmp mkdir -p /tmp/m1 mount --rbind /root /tmp/m1 the new tree now looks like this:: root / \ tmp usr / m1 / \ tmp usr step 3: :: mkdir -p /tmp/m2 mount --rbind /root /tmp/m2 the new tree now looks like this:: root / \ tmp usr / \ m1 m2 / \ / \ tmp usr tmp usr step 4: :: mkdir -p /tmp/m3 mount --rbind /root /tmp/m3 the new tree now looks like this:: root / \ tmp usr / \ \ m1 m2 m3 / \ / \ / \ tmp usr tmp usr tmp usr h](h)}(h\Let's say we want to replicate the mount tree at multiple locations within the same subtree.h]h^Let’s say we want to replicate the mount tree at multiple locations within the same subtree.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hif one rbind mounts a tree within the same subtree 'n' times the number of mounts created is an exponential function of 'n'. Having unbindable mount can help prune the unneeded bind mounts. Here is an example.h]hif one rbind mounts a tree within the same subtree ‘n’ times the number of mounts created is an exponential function of ‘n’. Having unbindable mount can help prune the unneeded bind mounts. Here is an example.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubjk)}(hhh](jp)}(hstep 1: let's say the root tree has just two directories with one vfsmount:: root / \ tmp usr And we want to replicate the tree at multiple mountpoints under /root/tmp h](jv)}(hstep 1:h]hstep 1:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjubj)}(hhh](h)}(hDlet's say the root tree has just two directories with one vfsmount::h]hElet’s say the root tree has just two directories with one vfsmount:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj)}(h root / \ tmp usr And we want to replicate the tree at multiple mountpoints under /root/tmph]h root / \ tmp usr And we want to replicate the tree at multiple mountpoints under /root/tmp}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhMhjubjp)}(hXstep 2: :: mount --make-shared /root mkdir -p /tmp/m1 mount --rbind /root /tmp/m1 the new tree now looks like this:: root / \ tmp usr / m1 / \ tmp usr / m1 it has two vfsmounts h](jv)}(hstep 2:h]hstep 2:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjubj)}(hhh](j)}(hHmount --make-shared /root mkdir -p /tmp/m1 mount --rbind /root /tmp/m1h]hHmount --make-shared /root mkdir -p /tmp/m1 mount --rbind /root /tmp/m1}hj#sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj ubh)}(h"the new tree now looks like this::h]h!the new tree now looks like this:}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubj)}(hu root / \ tmp usr / m1 / \ tmp usr / m1 it has two vfsmountsh]hu root / \ tmp usr / m1 / \ tmp usr / m1 it has two vfsmounts}hj?sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj ubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhMhjubjp)}(hXstep 3: :: mkdir -p /tmp/m2 mount --rbind /root /tmp/m2 the new tree now looks like this:: root / \ tmp usr / \ m1 m2 / \ / \ tmp usr tmp usr / \ / m1 m2 m1 / \ / \ tmp usr tmp usr / / \ m1 m1 m2 / \ tmp usr / \ m1 m2 it has 6 vfsmounts h](jv)}(hstep 3:h]hstep 3:}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjYubj)}(hhh]j)}(hX mkdir -p /tmp/m2 mount --rbind /root /tmp/m2 the new tree now looks like this:: root / \ tmp usr / \ m1 m2 / \ / \ tmp usr tmp usr / \ / m1 m2 m1 / \ / \ tmp usr tmp usr / / \ m1 m1 m2 / \ tmp usr / \ m1 m2 it has 6 vfsmountsh]hX mkdir -p /tmp/m2 mount --rbind /root /tmp/m2 the new tree now looks like this:: root / \ tmp usr / \ m1 m2 / \ / \ tmp usr tmp usr / \ / m1 m2 m1 / \ / \ tmp usr tmp usr / / \ m1 m1 m2 / \ tmp usr / \ m1 m2 it has 6 vfsmounts}hjnsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjkubah}(h]h ]h"]h$]h&]uh1jhjYubeh}(h]h ]h"]h$]h&]uh1johhhMhjubjp)}(hustep 4: :: mkdir -p /tmp/m3 mount --rbind /root /tmp/m3 I won't draw the tree..but it has 24 vfsmounts h](jv)}(hstep 4:h]hstep 4:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjubj)}(hhh]jk)}(hhh]jp)}(ha:: mkdir -p /tmp/m3 mount --rbind /root /tmp/m3 I won't draw the tree..but it has 24 vfsmounts h](jv)}(h::h]h::}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjubj)}(hhh](h)}(h,mkdir -p /tmp/m3 mount --rbind /root /tmp/m3h]h,mkdir -p /tmp/m3 mount --rbind /root /tmp/m3}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(h.I won't draw the tree..but it has 24 vfsmountsh]h0I won’t draw the tree..but it has 24 vfsmounts}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhMhjubah}(h]h ]h"]h$]h&]uh1jjhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhMhjubeh}(h]h ]h"]h$]h&]uh1jjhjubh)}(hat step i the number of vfsmounts is V[i] = i*V[i-1]. This is an exponential function. And this tree has way more mounts than what we really needed in the first place.h]hat step i the number of vfsmounts is V[i] = i*V[i-1]. This is an exponential function. And this tree has way more mounts than what we really needed in the first place.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hOne could use a series of umount at each step to prune out the unneeded mounts. But there is a better solution. Unclonable mounts come in handy here.h]hOne could use a series of umount at each step to prune out the unneeded mounts. But there is a better solution. Unclonable mounts come in handy here.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubjk)}(hhh](jp)}(hstep 1: let's say the root tree has just two directories with one vfsmount:: root / \ tmp usr How do we set up the same tree at multiple locations under /root/tmp h](jv)}(hstep 1:h]hstep 1:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjubj)}(hhh](h)}(hDlet's say the root tree has just two directories with one vfsmount::h]hElet’s say the root tree has just two directories with one vfsmount:}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj&ubj)}(h root / \ tmp usr How do we set up the same tree at multiple locations under /root/tmph]h root / \ tmp usr How do we set up the same tree at multiple locations under /root/tmp}hj7sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj&ubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhMhjubjp)}(hX<step 2: :: mount --bind /root/tmp /root/tmp mount --make-rshared /root mount --make-unbindable /root/tmp mkdir -p /tmp/m1 mount --rbind /root /tmp/m1 the new tree now looks like this:: root / \ tmp usr / m1 / \ tmp usr h](jv)}(hstep 2:h]hstep 2:}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhM,hjQubj)}(hhh](j)}(hmount --bind /root/tmp /root/tmp mount --make-rshared /root mount --make-unbindable /root/tmp mkdir -p /tmp/m1 mount --rbind /root /tmp/m1h]hmount --bind /root/tmp /root/tmp mount --make-rshared /root mount --make-unbindable /root/tmp mkdir -p /tmp/m1 mount --rbind /root /tmp/m1}hjfsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjcubh)}(h"the new tree now looks like this::h]h!the new tree now looks like this:}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM$hjcubj)}(h@ root / \ tmp usr / m1 / \ tmp usrh]h@ root / \ tmp usr / m1 / \ tmp usr}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM&hjcubeh}(h]h ]h"]h$]h&]uh1jhjQubeh}(h]h ]h"]h$]h&]uh1johhhM,hjubjp)}(hstep 3: :: mkdir -p /tmp/m2 mount --rbind /root /tmp/m2 the new tree now looks like this:: root / \ tmp usr / \ m1 m2 / \ / \ tmp usr tmp usr h](jv)}(hstep 3:h]hstep 3:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhM<hjubj)}(hhh](j)}(h,mkdir -p /tmp/m2 mount --rbind /root /tmp/m2h]h,mkdir -p /tmp/m2 mount --rbind /root /tmp/m2}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM1hjubh)}(h"the new tree now looks like this::h]h!the new tree now looks like this:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hjubj)}(h[ root / \ tmp usr / \ m1 m2 / \ / \ tmp usr tmp usrh]h[ root / \ tmp usr / \ m1 m2 / \ / \ tmp usr tmp usr}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM6hjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhM<hjubjp)}(hX0step 4: :: mkdir -p /tmp/m3 mount --rbind /root /tmp/m3 the new tree now looks like this:: root / \ tmp usr / \ \ m1 m2 m3 / \ / \ / \ tmp usr tmp usr tmp usr h](jv)}(hstep 4:h]hstep 4:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMLhjubj)}(hhh](j)}(h,mkdir -p /tmp/m3 mount --rbind /root /tmp/m3h]h,mkdir -p /tmp/m3 mount --rbind /root /tmp/m3}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMAhjubh)}(h"the new tree now looks like this::h]h!the new tree now looks like this:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMDhjubj)}(h root / \ tmp usr / \ \ m1 m2 m3 / \ / \ / \ tmp usr tmp usr tmp usrh]h root / \ tmp usr / \ \ m1 m2 m3 / \ / \ / \ tmp usr tmp usr tmp usr}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMFhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhMLhjubeh}(h]h ]h"]h$]h&]uh1jjhjubeh}(h]h ]h"]h$]h&]uh1j;hhhMhj>ubeh}(h]h ]h"]h$]h&]uh1j;hhhMhj-hhubeh}(h]faqah ]h"]7) faqah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h8) Implementationh]h8) Implementation}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjLhhhhhMOubh)}(h8A) Datastructureh]h8A) Datastructure}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMQhjLhhubj<)}(hXn 4 new fields are introduced to struct vfsmount: * ->mnt_share * ->mnt_slave_list * ->mnt_slave * ->mnt_master ->mnt_share links together all the mount to/from which this vfsmount send/receives propagation events. ->mnt_slave_list links all the mounts to which this vfsmount propagates to. ->mnt_slave links together all the slaves that its master vfsmount propagates to. ->mnt_master points to the master vfsmount from which this vfsmount receives propagation. ->mnt_flags takes two more flags to indicate the propagation status of the vfsmount. MNT_SHARE indicates that the vfsmount is a shared vfsmount. MNT_UNCLONABLE indicates that the vfsmount cannot be replicated. All the shared vfsmounts in a peer group form a cyclic list through ->mnt_share. All vfsmounts with the same ->mnt_master form on a cyclic list anchored in ->mnt_master->mnt_slave_list and going through ->mnt_slave. ->mnt_master can point to arbitrary (and possibly different) members of master peer group. To find all immediate slaves of a peer group you need to go through _all_ ->mnt_slave_list of its members. Conceptually it's just a single set - distribution among the individual lists does not affect propagation or the way propagation tree is modified by operations. All vfsmounts in a peer group have the same ->mnt_master. If it is non-NULL, they form a contiguous (ordered) segment of slave list. A example propagation tree looks as shown in the figure below. [ NOTE: Though it looks like a forest, if we consider all the shared mounts as a conceptual entity called 'pnode', it becomes a tree]:: A <--> B <--> C <---> D /|\ /| |\ / F G J K H I / E<-->K /|\ M L N In the above figure A,B,C and D all are shared and propagate to each other. 'A' has got 3 slave mounts 'E' 'F' and 'G' 'C' has got 2 slave mounts 'J' and 'K' and 'D' has got two slave mounts 'H' and 'I'. 'E' is also shared with 'K' and they propagate to each other. And 'K' has 3 slaves 'M', 'L' and 'N' A's ->mnt_share links with the ->mnt_share of 'B' 'C' and 'D' A's ->mnt_slave_list links with ->mnt_slave of 'E', 'K', 'F' and 'G' E's ->mnt_share links with ->mnt_share of K 'E', 'K', 'F', 'G' have their ->mnt_master point to struct vfsmount of 'A' 'M', 'L', 'N' have their ->mnt_master point to struct vfsmount of 'K' K's ->mnt_slave_list links with ->mnt_slave of 'M', 'L' and 'N' C's ->mnt_slave_list links with ->mnt_slave of 'J' and 'K' J and K's ->mnt_master points to struct vfsmount of C and finally D's ->mnt_slave_list links with ->mnt_slave of 'H' and 'I' 'H' and 'I' have their ->mnt_master pointing to struct vfsmount of 'D'. NOTE: The propagation tree is orthogonal to the mount tree. h](h)}(h/4 new fields are introduced to struct vfsmount:h]h/4 new fields are introduced to struct vfsmount:}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMShjkubh bullet_list)}(hhh](jG)}(h ->mnt_shareh]h)}(hjh]h ->mnt_share}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMUhjubah}(h]h ]h"]h$]h&]uh1jFhjubjG)}(h->mnt_slave_listh]h)}(hjh]h->mnt_slave_list}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMVhjubah}(h]h ]h"]h$]h&]uh1jFhjubjG)}(h ->mnt_slaveh]h)}(hjh]h ->mnt_slave}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMWhjubah}(h]h ]h"]h$]h&]uh1jFhjubjG)}(h ->mnt_master h]h)}(h ->mnt_masterh]h ->mnt_master}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMXhjubah}(h]h ]h"]h$]h&]uh1jFhjubeh}(h]h ]h"]h$]h&]bullet*uh1j}hhhMUhjkubjk)}(hhh](jp)}(hg->mnt_share links together all the mount to/from which this vfsmount send/receives propagation events. h](jv)}(h ->mnt_shareh]h ->mnt_share}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhM\hjubj)}(hhh]h)}(hZlinks together all the mount to/from which this vfsmount send/receives propagation events.h]hZlinks together all the mount to/from which this vfsmount send/receives propagation events.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM[hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhM\hjubjp)}(hL->mnt_slave_list links all the mounts to which this vfsmount propagates to. h](jv)}(h->mnt_slave_listh]h->mnt_slave_list}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhM`hjubj)}(hhh]h)}(h:links all the mounts to which this vfsmount propagates to.h]h:links all the mounts to which this vfsmount propagates to.}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM_hj+ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhM`hjubjp)}(hR->mnt_slave links together all the slaves that its master vfsmount propagates to. h](jv)}(h ->mnt_slaveh]h ->mnt_slave}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMdhjHubj)}(hhh]h)}(hElinks together all the slaves that its master vfsmount propagates to.h]hElinks together all the slaves that its master vfsmount propagates to.}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMchjZubah}(h]h ]h"]h$]h&]uh1jhjHubeh}(h]h ]h"]h$]h&]uh1johhhMdhjubjp)}(hZ->mnt_master points to the master vfsmount from which this vfsmount receives propagation. h](jv)}(h ->mnt_masterh]h ->mnt_master}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhhjwubj)}(hhh]h)}(hLpoints to the master vfsmount from which this vfsmount receives propagation.h]hLpoints to the master vfsmount from which this vfsmount receives propagation.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMghjubah}(h]h ]h"]h$]h&]uh1jhjwubeh}(h]h ]h"]h$]h&]uh1johhhMhhjubjp)}(h->mnt_flags takes two more flags to indicate the propagation status of the vfsmount. MNT_SHARE indicates that the vfsmount is a shared vfsmount. MNT_UNCLONABLE indicates that the vfsmount cannot be replicated. h](jv)}(h ->mnt_flagsh]h ->mnt_flags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMnhjubj)}(hhh]h)}(htakes two more flags to indicate the propagation status of the vfsmount. MNT_SHARE indicates that the vfsmount is a shared vfsmount. MNT_UNCLONABLE indicates that the vfsmount cannot be replicated.h]htakes two more flags to indicate the propagation status of the vfsmount. MNT_SHARE indicates that the vfsmount is a shared vfsmount. MNT_UNCLONABLE indicates that the vfsmount cannot be replicated.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMkhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhMnhjubeh}(h]h ]h"]h$]h&]uh1jjhjkubh)}(hPAll the shared vfsmounts in a peer group form a cyclic list through ->mnt_share.h]hPAll the shared vfsmounts in a peer group form a cyclic list through ->mnt_share.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMphjkubh)}(hAll vfsmounts with the same ->mnt_master form on a cyclic list anchored in ->mnt_master->mnt_slave_list and going through ->mnt_slave.h]hAll vfsmounts with the same ->mnt_master form on a cyclic list anchored in ->mnt_master->mnt_slave_list and going through ->mnt_slave.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMshjkubj<)}(hXh->mnt_master can point to arbitrary (and possibly different) members of master peer group. To find all immediate slaves of a peer group you need to go through _all_ ->mnt_slave_list of its members. Conceptually it's just a single set - distribution among the individual lists does not affect propagation or the way propagation tree is modified by operations. h]h)}(hXg->mnt_master can point to arbitrary (and possibly different) members of master peer group. To find all immediate slaves of a peer group you need to go through _all_ ->mnt_slave_list of its members. Conceptually it's just a single set - distribution among the individual lists does not affect propagation or the way propagation tree is modified by operations.h]hXi->mnt_master can point to arbitrary (and possibly different) members of master peer group. To find all immediate slaves of a peer group you need to go through _all_ ->mnt_slave_list of its members. Conceptually it’s just a single set - distribution among the individual lists does not affect propagation or the way propagation tree is modified by operations.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMvhjubah}(h]h ]h"]h$]h&]uh1j;hhhMvhjkubh)}(hAll vfsmounts in a peer group have the same ->mnt_master. If it is non-NULL, they form a contiguous (ordered) segment of slave list.h]hAll vfsmounts in a peer group have the same ->mnt_master. If it is non-NULL, they form a contiguous (ordered) segment of slave list.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM}hjkubh)}(hA example propagation tree looks as shown in the figure below. [ NOTE: Though it looks like a forest, if we consider all the shared mounts as a conceptual entity called 'pnode', it becomes a tree]::h]hA example propagation tree looks as shown in the figure below. [ NOTE: Though it looks like a forest, if we consider all the shared mounts as a conceptual entity called ‘pnode’, it becomes a tree]:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubj)}(hq A <--> B <--> C <---> D /|\ /| |\ / F G J K H I / E<-->K /|\ M L Nh]hq A <--> B <--> C <---> D /|\ /| |\ / F G J K H I / E<-->K /|\ M L N}hj+sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjkubh)}(hX5In the above figure A,B,C and D all are shared and propagate to each other. 'A' has got 3 slave mounts 'E' 'F' and 'G' 'C' has got 2 slave mounts 'J' and 'K' and 'D' has got two slave mounts 'H' and 'I'. 'E' is also shared with 'K' and they propagate to each other. And 'K' has 3 slaves 'M', 'L' and 'N'h]hXuIn the above figure A,B,C and D all are shared and propagate to each other. ‘A’ has got 3 slave mounts ‘E’ ‘F’ and ‘G’ ‘C’ has got 2 slave mounts ‘J’ and ‘K’ and ‘D’ has got two slave mounts ‘H’ and ‘I’. ‘E’ is also shared with ‘K’ and they propagate to each other. And ‘K’ has 3 slaves ‘M’, ‘L’ and ‘N’}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(h=A's ->mnt_share links with the ->mnt_share of 'B' 'C' and 'D'h]hKA’s ->mnt_share links with the ->mnt_share of ‘B’ ‘C’ and ‘D’}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(hDA's ->mnt_slave_list links with ->mnt_slave of 'E', 'K', 'F' and 'G'h]hVA’s ->mnt_slave_list links with ->mnt_slave of ‘E’, ‘K’, ‘F’ and ‘G’}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(h+E's ->mnt_share links with ->mnt_share of Kh]h-E’s ->mnt_share links with ->mnt_share of K}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(hJ'E', 'K', 'F', 'G' have their ->mnt_master point to struct vfsmount of 'A'h]h^‘E’, ‘K’, ‘F’, ‘G’ have their ->mnt_master point to struct vfsmount of ‘A’}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(hE'M', 'L', 'N' have their ->mnt_master point to struct vfsmount of 'K'h]hU‘M’, ‘L’, ‘N’ have their ->mnt_master point to struct vfsmount of ‘K’}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(h?K's ->mnt_slave_list links with ->mnt_slave of 'M', 'L' and 'N'h]hMK’s ->mnt_slave_list links with ->mnt_slave of ‘M’, ‘L’ and ‘N’}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(h:C's ->mnt_slave_list links with ->mnt_slave of 'J' and 'K'h]hDC’s ->mnt_slave_list links with ->mnt_slave of ‘J’ and ‘K’}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(h5J and K's ->mnt_master points to struct vfsmount of Ch]h7J and K’s ->mnt_master points to struct vfsmount of C}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(hFand finally D's ->mnt_slave_list links with ->mnt_slave of 'H' and 'I'h]hPand finally D’s ->mnt_slave_list links with ->mnt_slave of ‘H’ and ‘I’}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(hG'H' and 'I' have their ->mnt_master pointing to struct vfsmount of 'D'.h]hS‘H’ and ‘I’ have their ->mnt_master pointing to struct vfsmount of ‘D’.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubh)}(h;NOTE: The propagation tree is orthogonal to the mount tree.h]h;NOTE: The propagation tree is orthogonal to the mount tree.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjkubeh}(h]h ]h"]h$]h&]uh1j;hhhMShjLhhubh)}(h 8B Locking:h]h 8B Locking:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjLhhubj<)}(hX->mnt_share, ->mnt_slave, ->mnt_slave_list, ->mnt_master are protected by namespace_sem (exclusive for modifications, shared for reading). Normally we have ->mnt_flags modifications serialized by vfsmount_lock. There are two exceptions: do_add_mount() and clone_mnt(). The former modifies a vfsmount that has not been visible in any shared data structures yet. The latter holds namespace_sem and the only references to vfsmount are in lists that can't be traversed without namespace_sem. h](h)}(h->mnt_share, ->mnt_slave, ->mnt_slave_list, ->mnt_master are protected by namespace_sem (exclusive for modifications, shared for reading).h]h->mnt_share, ->mnt_slave, ->mnt_slave_list, ->mnt_master are protected by namespace_sem (exclusive for modifications, shared for reading).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hX\Normally we have ->mnt_flags modifications serialized by vfsmount_lock. There are two exceptions: do_add_mount() and clone_mnt(). The former modifies a vfsmount that has not been visible in any shared data structures yet. The latter holds namespace_sem and the only references to vfsmount are in lists that can't be traversed without namespace_sem.h]hX^Normally we have ->mnt_flags modifications serialized by vfsmount_lock. There are two exceptions: do_add_mount() and clone_mnt(). The former modifies a vfsmount that has not been visible in any shared data structures yet. The latter holds namespace_sem and the only references to vfsmount are in lists that can’t be traversed without namespace_sem.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1j;hhhMhjLhhubh)}(h 8C Algorithm:h]h 8C Algorithm:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjLhhubj<)}(hXThe crux of the implementation resides in rbind/move operation. The overall algorithm breaks the operation into 3 phases: (look at attach_recursive_mnt() and propagate_mnt()) 1. prepare phase. 2. commit phases. 3. abort phases. Prepare phase: for each mount in the source tree: a) Create the necessary number of mount trees to be attached to each of the mounts that receive propagation from the destination mount. b) Do not attach any of the trees to its destination. However note down its ->mnt_parent and ->mnt_mountpoint c) Link all the new mounts to form a propagation tree that is identical to the propagation tree of the destination mount. If this phase is successful, there should be 'n' new propagation trees; where 'n' is the number of mounts in the source tree. Go to the commit phase Also there should be 'm' new mount trees, where 'm' is the number of mounts to which the destination mount propagates to. if any memory allocations fail, go to the abort phase. Commit phase attach each of the mount trees to their corresponding destination mounts. Abort phase delete all the newly created trees. .. Note:: all the propagation related functionality resides in the file pnode.c h](h)}(h?The crux of the implementation resides in rbind/move operation.h]h?The crux of the implementation resides in rbind/move operation.}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj)ubh)}(hnThe overall algorithm breaks the operation into 3 phases: (look at attach_recursive_mnt() and propagate_mnt())h]hnThe overall algorithm breaks the operation into 3 phases: (look at attach_recursive_mnt() and propagate_mnt())}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj)ubjB)}(hhh](jG)}(hprepare phase.h]h)}(hjNh]hprepare phase.}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjLubah}(h]h ]h"]h$]h&]uh1jFhjIubjG)}(hcommit phases.h]h)}(hjeh]hcommit phases.}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjcubah}(h]h ]h"]h$]h&]uh1jFhjIubjG)}(habort phases. h]h)}(h abort phases.h]h abort phases.}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjzubah}(h]h ]h"]h$]h&]uh1jFhjIubeh}(h]h ]h"]h$]h&]jjjhjjuh1jAhj)ubh)}(hPrepare phase:h]hPrepare phase:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj)ubh)}(h"for each mount in the source tree:h]h"for each mount in the source tree:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj)ubj<)}(hXa) Create the necessary number of mount trees to be attached to each of the mounts that receive propagation from the destination mount. b) Do not attach any of the trees to its destination. However note down its ->mnt_parent and ->mnt_mountpoint c) Link all the new mounts to form a propagation tree that is identical to the propagation tree of the destination mount. If this phase is successful, there should be 'n' new propagation trees; where 'n' is the number of mounts in the source tree. Go to the commit phase Also there should be 'm' new mount trees, where 'm' is the number of mounts to which the destination mount propagates to. if any memory allocations fail, go to the abort phase. h](jB)}(hhh](jG)}(hCreate the necessary number of mount trees to be attached to each of the mounts that receive propagation from the destination mount.h]jk)}(hhh]jp)}(hCreate the necessary number of mount trees to be attached to each of the mounts that receive propagation from the destination mount.h](jv)}(h-Create the necessary number of mount trees toh]h-Create the necessary number of mount trees to}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjubj)}(hhh]h)}(hVbe attached to each of the mounts that receive propagation from the destination mount.h]hVbe attached to each of the mounts that receive propagation from the destination mount.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhMhjubah}(h]h ]h"]h$]h&]uh1jjhjubah}(h]h ]h"]h$]h&]uh1jFhjubjG)}(hjDo not attach any of the trees to its destination. However note down its ->mnt_parent and ->mnt_mountpointh]h)}(hjDo not attach any of the trees to its destination. However note down its ->mnt_parent and ->mnt_mountpointh]hjDo not attach any of the trees to its destination. However note down its ->mnt_parent and ->mnt_mountpoint}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jFhjubjG)}(hwLink all the new mounts to form a propagation tree that is identical to the propagation tree of the destination mount. h]h)}(hvLink all the new mounts to form a propagation tree that is identical to the propagation tree of the destination mount.h]hvLink all the new mounts to form a propagation tree that is identical to the propagation tree of the destination mount.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jFhjubeh}(h]h ]h"]h$]h&]jjjhjjuh1jAhjubh)}(hIf this phase is successful, there should be 'n' new propagation trees; where 'n' is the number of mounts in the source tree. Go to the commit phaseh]hIf this phase is successful, there should be ‘n’ new propagation trees; where ‘n’ is the number of mounts in the source tree. Go to the commit phase}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hyAlso there should be 'm' new mount trees, where 'm' is the number of mounts to which the destination mount propagates to.h]hAlso there should be ‘m’ new mount trees, where ‘m’ is the number of mounts to which the destination mount propagates to.}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(h6if any memory allocations fail, go to the abort phase.h]h6if any memory allocations fail, go to the abort phase.}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1j;hhhMhj)ubjk)}(hhh](jp)}(hWCommit phase attach each of the mount trees to their corresponding destination mounts. h](jv)}(h Commit phaseh]h Commit phase}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjfubj)}(hhh]h)}(hIattach each of the mount trees to their corresponding destination mounts.h]hIattach each of the mount trees to their corresponding destination mounts.}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjxubah}(h]h ]h"]h$]h&]uh1jhjfubeh}(h]h ]h"]h$]h&]uh1johhhMhjcubjp)}(h0Abort phase delete all the newly created trees. h](jv)}(h Abort phaseh]h Abort phase}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1juhhhMhjubj)}(hhh]h)}(h#delete all the newly created trees.h]h#delete all the newly created trees.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1johhhMhjcubeh}(h]h ]h"]h$]h&]uh1jjhj)ubj, )}(hEall the propagation related functionality resides in the file pnode.ch]h)}(hjh]hEall the propagation related functionality resides in the file pnode.c}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1j+ hj)ubeh}(h]h ]h"]h$]h&]uh1j;hhhMhjLhhubh transition)}(hH------------------------------------------------------------------------h]h}(h]h ]h"]h$]h&]uh1jhhhMhjLhhubh)}(hHversion 0.1 (created the initial document, Ram Pai linuxram@us.ibm.com)h](h4version 0.1 (created the initial document, Ram Pai }(hjhhhNhNubh reference)}(hlinuxram@us.ibm.comh]hlinuxram@us.ibm.com}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurimailto:linuxram@us.ibm.comuh1jhjubh)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjLhhubh)}(h1version 0.2 (Incorporated comments from Al Viro)h]h1version 0.2 (Incorporated comments from Al Viro)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjLhhubeh}(h]implementationah ]h"]8) implementationah$]h&]uh1hhhhhhhhMOubeh}(h]shared-subtreesah ]h"]shared subtreesah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjXerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j2j/jjjjj(j%jjjjj*j'jIjFj*j'u nametypes}(j2jjj(jjj*jIj*uh}(j/hjhjjj%jjj+jjj'jjFj-j'jLu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages](hsystem_message)}(hhh]h)}(h:Enumerated list start value not ordinal-1: "C" (ordinal 3)h]h>Enumerated list start value not ordinal-1: “C” (ordinal 3)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1jhj<ubj)}(hhh]h)}(h`Blank line missing before literal block (after the "::")? Interpreted as a definition list item.h]hdBlank line missing before literal block (after the “::”)? Interpreted as a definition list item.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejlineMsourcehuh1jhjubetransform_messages] transformerN include_log] decorationNhhub.