aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorRam Pai <linuxram@us.ibm.com>2005-11-07 17:21:01 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 21:18:11 -0500
commit5afe00221389998a25d611dc7941c06580c29eb6 (patch)
tree521270fb5974b42ac2b27666541f20fd375d8f66 /fs/namespace.c
parenta58b0eb8e64b78d9315a5491955e78b1391d42e5 (diff)
[PATCH] handling of slave mounts
This makes bind, rbind, move, clone namespace and umount operations aware of the semantics of slave mount (see Documentation/sharedsubtree.txt in the last patch of the series for detailed description). Signed-off-by: Ram Pai <linuxram@us.ibm.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c77
1 files changed, 49 insertions, 28 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 46f99bc585bd..089670363704 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -227,8 +227,17 @@ static struct vfsmount *clone_mnt(struct vfsmount *old, struct dentry *root,
227 mnt->mnt_mountpoint = mnt->mnt_root; 227 mnt->mnt_mountpoint = mnt->mnt_root;
228 mnt->mnt_parent = mnt; 228 mnt->mnt_parent = mnt;
229 229
230 if ((flag & CL_PROPAGATION) || IS_MNT_SHARED(old)) 230 if (flag & CL_SLAVE) {
231 list_add(&mnt->mnt_share, &old->mnt_share); 231 list_add(&mnt->mnt_slave, &old->mnt_slave_list);
232 mnt->mnt_master = old;
233 CLEAR_MNT_SHARED(mnt);
234 } else {
235 if ((flag & CL_PROPAGATION) || IS_MNT_SHARED(old))
236 list_add(&mnt->mnt_share, &old->mnt_share);
237 if (IS_MNT_SLAVE(old))
238 list_add(&mnt->mnt_slave, &old->mnt_slave);
239 mnt->mnt_master = old->mnt_master;
240 }
232 if (flag & CL_MAKE_SHARED) 241 if (flag & CL_MAKE_SHARED)
233 set_mnt_shared(mnt); 242 set_mnt_shared(mnt);
234 243
@@ -689,18 +698,18 @@ Enomem:
689 * 698 *
690 * NOTE: in the table below explains the semantics when a source mount 699 * NOTE: in the table below explains the semantics when a source mount
691 * of a given type is attached to a destination mount of a given type. 700 * of a given type is attached to a destination mount of a given type.
692 * --------------------------------------------- 701 * -------------------------------------------------------------
693 * | BIND MOUNT OPERATION | 702 * | BIND MOUNT OPERATION |
694 * |******************************************** 703 * |*************************************************************
695 * | source-->| shared | private | 704 * | source-->| shared | private | slave |
696 * | dest | | | 705 * | dest | | | |
697 * | | | | | 706 * | | | | | |
698 * | v | | | 707 * | v | | | |
699 * |******************************************** 708 * |*************************************************************
700 * | shared | shared (++) | shared (+) | 709 * | shared | shared (++) | shared (+) | shared(+++)|
701 * | | | | 710 * | | | | |
702 * |non-shared| shared (+) | private | 711 * |non-shared| shared (+) | private | slave (*) |
703 * ********************************************* 712 * **************************************************************
704 * A bind operation clones the source mount and mounts the clone on the 713 * A bind operation clones the source mount and mounts the clone on the
705 * destination mount. 714 * destination mount.
706 * 715 *
@@ -710,21 +719,33 @@ Enomem:
710 * (+) the cloned mount is created under the destination mount and is marked 719 * (+) the cloned mount is created under the destination mount and is marked
711 * as shared. The cloned mount is added to the peer group of the source 720 * as shared. The cloned mount is added to the peer group of the source
712 * mount. 721 * mount.
713 * --------------------------------------------- 722 * (+++) the mount is propagated to all the mounts in the propagation tree
714 * | MOVE MOUNT OPERATION | 723 * of the destination mount and the cloned mount is made slave
715 * |******************************************** 724 * of the same master as that of the source mount. The cloned mount
716 * | source-->| shared | private | 725 * is marked as 'shared and slave'.
717 * | dest | | | 726 * (*) the cloned mount is made a slave of the same master as that of the
718 * | | | | | 727 * source mount.
719 * | v | | | 728 *
720 * |******************************************** 729 * --------------------------------------------------------------
721 * | shared | shared (+) | shared (+) | 730 * | MOVE MOUNT OPERATION |
722 * | | | | 731 * |*************************************************************
723 * |non-shared| shared (+*) | private | 732 * | source-->| shared | private | slave |
724 * ********************************************* 733 * | dest | | | |
725 * (+) the mount is moved to the destination. And is then propagated to all 734 * | | | | | |
726 * the mounts in the propagation tree of the destination mount. 735 * | v | | | |
736 * |*************************************************************
737 * | shared | shared (+) | shared (+) | shared(+++) |
738 * | | | | |
739 * |non-shared| shared (+*) | private | slave (*) |
740 * **************************************************************
741 *
742 * (+) the mount is moved to the destination. And is then propagated to
743 * all the mounts in the propagation tree of the destination mount.
727 * (+*) the mount is moved to the destination. 744 * (+*) the mount is moved to the destination.
745 * (+++) the mount is moved to the destination and is then propagated to
746 * all the mounts belonging to the destination mount's propagation tree.
747 * the mount is marked as 'shared and slave'.
748 * (*) the mount continues to be a slave at the new location.
728 * 749 *
729 * if the source mount is a tree, the operations explained above is 750 * if the source mount is a tree, the operations explained above is
730 * applied to each mount in the tree. 751 * applied to each mount in the tree.