[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>
This commit is contained in:
Ram Pai 2005-11-07 17:19:07 -05:00 committed by Linus Torvalds
parent 390c684367
commit 07b20889e3
6 changed files with 62 additions and 6 deletions

View file

@ -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);
@ -662,6 +663,27 @@ out_unlock:
return err;
}
/*
* 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.
*/
@ -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