|
24 | 24 | #include <linux/mount.h>
|
25 | 25 | #include <asm/uaccess.h>
|
26 | 26 | #include <asm/unistd.h>
|
| 27 | +#include "pnode.h" |
27 | 28 |
|
28 | 29 | extern int __init init_rootfs(void);
|
29 | 30 |
|
@@ -662,6 +663,27 @@ static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
|
662 | 663 | return err;
|
663 | 664 | }
|
664 | 665 |
|
| 666 | +/* |
| 667 | + * recursively change the type of the mountpoint. |
| 668 | + */ |
| 669 | +static 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 | + |
665 | 687 | /*
|
666 | 688 | * do loopback mount.
|
667 | 689 | */
|
@@ -1091,6 +1113,8 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
|
1091 | 1113 | data_page);
|
1092 | 1114 | else if (flags & MS_BIND)
|
1093 | 1115 | retval = do_loopback(&nd, dev_name, flags & MS_REC);
|
| 1116 | + else if (flags & MS_PRIVATE) |
| 1117 | + retval = do_change_type(&nd, flags); |
1094 | 1118 | else if (flags & MS_MOVE)
|
1095 | 1119 | retval = do_move_mount(&nd, dev_name);
|
1096 | 1120 | else
|
|
0 commit comments