aboutsummaryrefslogtreecommitdiff
path: root/fs
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 18:18:10 -0800
commit07b20889e3052c7e77d6a6a54e7e83446eb1ba84 (patch)
tree616ac5b7eef3092e105d3b41e7bd2052558b064b /fs
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')
-rw-r--r--fs/Makefile2
-rw-r--r--fs/namespace.c24
-rw-r--r--fs/pnode.c17
-rw-r--r--fs/pnode.h14
4 files changed, 56 insertions, 1 deletions
diff --git a/fs/Makefile b/fs/Makefile
index 1972da18627..4c265575907 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -10,7 +10,7 @@ obj-y := open.o read_write.o file_table.o buffer.o bio.o super.o \
ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \
attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \
seq_file.o xattr.o libfs.o fs-writeback.o mpage.o direct-io.o \
- ioprio.o
+ ioprio.o pnode.o
obj-$(CONFIG_INOTIFY) += inotify.o
obj-$(CONFIG_EPOLL) += eventpoll.o
diff --git a/fs/namespace.c b/fs/namespace.c
index 4abee9ab009..3782923d6d4 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -24,6 +24,7 @@
#include <linux/mount.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
+#include "pnode.h"
extern int __init init_rootfs(void);
@@ -663,6 +664,27 @@ out_unlock:
}
/*
+ * recursively change the type of the mountpoint.
+ */
+static int do_change_type(struct nameidata *nd, int flag)
+{
+ struct vfsmount *m, *mnt = nd->mnt;
+ int recurse = flag & MS_REC;
+ int type = flag & ~MS_REC;
+
+ if (nd->dentry != nd->mnt->mnt_root)
+ return -EINVAL;
+
+ down_write(&namespace_sem);
+ spin_lock(&vfsmount_lock);
+ for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL))
+ change_mnt_propagation(m, type);
+ spin_unlock(&vfsmount_lock);
+ up_write(&namespace_sem);
+ return 0;
+}
+
+/*
* do loopback mount.
*/
static 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,
data_page);
else if (flags & MS_BIND)
retval = do_loopback(&nd, dev_name, flags & MS_REC);
+ else if (flags & MS_PRIVATE)
+ retval = do_change_type(&nd, flags);
else if (flags & MS_MOVE)
retval = do_move_mount(&nd, dev_name);
else
diff --git a/fs/pnode.c b/fs/pnode.c
new file mode 100644
index 00000000000..aaa0dffda12
--- /dev/null
+++ b/fs/pnode.c
@@ -0,0 +1,17 @@
+/*
+ * linux/fs/pnode.c
+ *
+ * (C) Copyright IBM Corporation 2005.
+ * Released under GPL v2.
+ * Author : Ram Pai (linuxram@us.ibm.com)
+ *
+ */
+#include <linux/namespace.h>
+#include <linux/mount.h>
+#include <linux/fs.h>
+#include "pnode.h"
+
+void change_mnt_propagation(struct vfsmount *mnt, int type)
+{
+ mnt->mnt_flags &= ~MNT_PNODE_MASK;
+}
diff --git a/fs/pnode.h b/fs/pnode.h
new file mode 100644
index 00000000000..33549a3a74e
--- /dev/null
+++ b/fs/pnode.h
@@ -0,0 +1,14 @@
+/*
+ * linux/fs/pnode.h
+ *
+ * (C) Copyright IBM Corporation 2005.
+ * Released under GPL v2.
+ *
+ */
+#ifndef _LINUX_PNODE_H
+#define _LINUX_PNODE_H
+
+#include <linux/list.h>
+#include <linux/mount.h>
+void change_mnt_propagation(struct vfsmount *, int);
+#endif /* _LINUX_PNODE_H */