aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorRam Pai <linuxram@us.ibm.com>2005-11-07 17:19:07 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 21:18:10 -0500
commit07b20889e3052c7e77d6a6a54e7e83446eb1ba84 (patch)
tree616ac5b7eef3092e105d3b41e7bd2052558b064b /fs/namespace.c
parent390c684367de37e1c2f9005cf92f7a746c69fdd3 (diff)
[PATCH] beginning of the shared-subtree proper
A private mount does not forward or receive propagation. This patch provides user the ability to convert any mount to private. 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.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 4abee9ab009f..3782923d6d4d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -24,6 +24,7 @@
24#include <linux/mount.h> 24#include <linux/mount.h>
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/unistd.h> 26#include <asm/unistd.h>
27#include "pnode.h"
27 28
28extern int __init init_rootfs(void); 29extern int __init init_rootfs(void);
29 30
@@ -663,6 +664,27 @@ out_unlock:
663} 664}
664 665
665/* 666/*
667 * recursively change the type of the mountpoint.
668 */
669static int do_change_type(struct nameidata *nd, int flag)
670{
671 struct vfsmount *m, *mnt = nd->mnt;
672 int recurse = flag & MS_REC;
673 int type = flag & ~MS_REC;
674
675 if (nd->dentry != nd->mnt->mnt_root)
676 return -EINVAL;
677
678 down_write(&namespace_sem);
679 spin_lock(&vfsmount_lock);
680 for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL))
681 change_mnt_propagation(m, type);
682 spin_unlock(&vfsmount_lock);
683 up_write(&namespace_sem);
684 return 0;
685}
686
687/*
666 * do loopback mount. 688 * do loopback mount.
667 */ 689 */
668static int do_loopback(struct nameidata *nd, char *old_name, int recurse) 690static int do_loopback(struct nameidata *nd, char *old_name, int recurse)
@@ -1091,6 +1113,8 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
1091 data_page); 1113 data_page);
1092 else if (flags & MS_BIND) 1114 else if (flags & MS_BIND)
1093 retval = do_loopback(&nd, dev_name, flags & MS_REC); 1115 retval = do_loopback(&nd, dev_name, flags & MS_REC);
1116 else if (flags & MS_PRIVATE)
1117 retval = do_change_type(&nd, flags);
1094 else if (flags & MS_MOVE) 1118 else if (flags & MS_MOVE)
1095 retval = do_move_mount(&nd, dev_name); 1119 retval = do_move_mount(&nd, dev_name);
1096 else 1120 else