diff options
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 66d921e14fee..55442a6cf221 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -133,7 +133,7 @@ struct vfsmount *lookup_mnt(struct vfsmount *mnt, struct dentry *dentry) | |||
133 | 133 | ||
134 | static inline int check_mnt(struct vfsmount *mnt) | 134 | static inline int check_mnt(struct vfsmount *mnt) |
135 | { | 135 | { |
136 | return mnt->mnt_namespace == current->namespace; | 136 | return mnt->mnt_namespace == current->nsproxy->namespace; |
137 | } | 137 | } |
138 | 138 | ||
139 | static void touch_namespace(struct namespace *ns) | 139 | static void touch_namespace(struct namespace *ns) |
@@ -830,7 +830,7 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt, | |||
830 | if (parent_nd) { | 830 | if (parent_nd) { |
831 | detach_mnt(source_mnt, parent_nd); | 831 | detach_mnt(source_mnt, parent_nd); |
832 | attach_mnt(source_mnt, nd); | 832 | attach_mnt(source_mnt, nd); |
833 | touch_namespace(current->namespace); | 833 | touch_namespace(current->nsproxy->namespace); |
834 | } else { | 834 | } else { |
835 | mnt_set_mountpoint(dest_mnt, dest_dentry, source_mnt); | 835 | mnt_set_mountpoint(dest_mnt, dest_dentry, source_mnt); |
836 | commit_tree(source_mnt); | 836 | commit_tree(source_mnt); |
@@ -1441,7 +1441,7 @@ dput_out: | |||
1441 | */ | 1441 | */ |
1442 | struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs) | 1442 | struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs) |
1443 | { | 1443 | { |
1444 | struct namespace *namespace = tsk->namespace; | 1444 | struct namespace *namespace = tsk->nsproxy->namespace; |
1445 | struct namespace *new_ns; | 1445 | struct namespace *new_ns; |
1446 | struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL; | 1446 | struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL; |
1447 | struct vfsmount *p, *q; | 1447 | struct vfsmount *p, *q; |
@@ -1508,7 +1508,7 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs) | |||
1508 | 1508 | ||
1509 | int copy_namespace(int flags, struct task_struct *tsk) | 1509 | int copy_namespace(int flags, struct task_struct *tsk) |
1510 | { | 1510 | { |
1511 | struct namespace *namespace = tsk->namespace; | 1511 | struct namespace *namespace = tsk->nsproxy->namespace; |
1512 | struct namespace *new_ns; | 1512 | struct namespace *new_ns; |
1513 | int err = 0; | 1513 | int err = 0; |
1514 | 1514 | ||
@@ -1531,7 +1531,7 @@ int copy_namespace(int flags, struct task_struct *tsk) | |||
1531 | goto out; | 1531 | goto out; |
1532 | } | 1532 | } |
1533 | 1533 | ||
1534 | tsk->namespace = new_ns; | 1534 | tsk->nsproxy->namespace = new_ns; |
1535 | 1535 | ||
1536 | out: | 1536 | out: |
1537 | put_namespace(namespace); | 1537 | put_namespace(namespace); |
@@ -1754,7 +1754,7 @@ asmlinkage long sys_pivot_root(const char __user * new_root, | |||
1754 | detach_mnt(user_nd.mnt, &root_parent); | 1754 | detach_mnt(user_nd.mnt, &root_parent); |
1755 | attach_mnt(user_nd.mnt, &old_nd); /* mount old root on put_old */ | 1755 | attach_mnt(user_nd.mnt, &old_nd); /* mount old root on put_old */ |
1756 | attach_mnt(new_nd.mnt, &root_parent); /* mount new_root on / */ | 1756 | attach_mnt(new_nd.mnt, &root_parent); /* mount new_root on / */ |
1757 | touch_namespace(current->namespace); | 1757 | touch_namespace(current->nsproxy->namespace); |
1758 | spin_unlock(&vfsmount_lock); | 1758 | spin_unlock(&vfsmount_lock); |
1759 | chroot_fs_refs(&user_nd, &new_nd); | 1759 | chroot_fs_refs(&user_nd, &new_nd); |
1760 | security_sb_post_pivotroot(&user_nd, &new_nd); | 1760 | security_sb_post_pivotroot(&user_nd, &new_nd); |
@@ -1780,7 +1780,6 @@ static void __init init_mount_tree(void) | |||
1780 | { | 1780 | { |
1781 | struct vfsmount *mnt; | 1781 | struct vfsmount *mnt; |
1782 | struct namespace *namespace; | 1782 | struct namespace *namespace; |
1783 | struct task_struct *g, *p; | ||
1784 | 1783 | ||
1785 | mnt = do_kern_mount("rootfs", 0, "rootfs", NULL); | 1784 | mnt = do_kern_mount("rootfs", 0, "rootfs", NULL); |
1786 | if (IS_ERR(mnt)) | 1785 | if (IS_ERR(mnt)) |
@@ -1796,13 +1795,8 @@ static void __init init_mount_tree(void) | |||
1796 | namespace->root = mnt; | 1795 | namespace->root = mnt; |
1797 | mnt->mnt_namespace = namespace; | 1796 | mnt->mnt_namespace = namespace; |
1798 | 1797 | ||
1799 | init_task.namespace = namespace; | 1798 | init_task.nsproxy->namespace = namespace; |
1800 | read_lock(&tasklist_lock); | 1799 | get_namespace(namespace); |
1801 | do_each_thread(g, p) { | ||
1802 | get_namespace(namespace); | ||
1803 | p->namespace = namespace; | ||
1804 | } while_each_thread(g, p); | ||
1805 | read_unlock(&tasklist_lock); | ||
1806 | 1800 | ||
1807 | set_fs_pwd(current->fs, namespace->root, namespace->root->mnt_root); | 1801 | set_fs_pwd(current->fs, namespace->root, namespace->root->mnt_root); |
1808 | set_fs_root(current->fs, namespace->root, namespace->root->mnt_root); | 1802 | set_fs_root(current->fs, namespace->root, namespace->root->mnt_root); |