Commit 2f99cc6e4688faf5f03f9afe5e1c6097278c75b2
1 parent
796a6b521d
Exists in
master
and in
4 other branches
add several pieces to shared subtree documentation
* document locking * add the missing part of data structure invariants (relationship between mnt_share and mnt_slave lists in case of a peer group among slaves). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 15 additions and 1 deletions Side-by-side Diff
Documentation/filesystems/sharedsubtree.txt
... | ... | @@ -837,6 +837,9 @@ |
837 | 837 | individual lists does not affect propagation or the way propagation |
838 | 838 | tree is modified by operations. |
839 | 839 | |
840 | + All vfsmounts in a peer group have the same ->mnt_master. If it is | |
841 | + non-NULL, they form a contiguous (ordered) segment of slave list. | |
842 | + | |
840 | 843 | A example propagation tree looks as shown in the figure below. |
841 | 844 | [ NOTE: Though it looks like a forest, if we consider all the shared |
842 | 845 | mounts as a conceptual entity called 'pnode', it becomes a tree] |
843 | 846 | |
... | ... | @@ -874,8 +877,19 @@ |
874 | 877 | |
875 | 878 | NOTE: The propagation tree is orthogonal to the mount tree. |
876 | 879 | |
880 | +8B Locking: | |
877 | 881 | |
878 | -8B Algorithm: | |
882 | + ->mnt_share, ->mnt_slave, ->mnt_slave_list, ->mnt_master are protected | |
883 | + by namespace_sem (exclusive for modifications, shared for reading). | |
884 | + | |
885 | + Normally we have ->mnt_flags modifications serialized by vfsmount_lock. | |
886 | + There are two exceptions: do_add_mount() and clone_mnt(). | |
887 | + The former modifies a vfsmount that has not been visible in any shared | |
888 | + data structures yet. | |
889 | + The latter holds namespace_sem and the only references to vfsmount | |
890 | + are in lists that can't be traversed without namespace_sem. | |
891 | + | |
892 | +8C Algorithm: | |
879 | 893 | |
880 | 894 | The crux of the implementation resides in rbind/move operation. |
881 | 895 |