diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2006-10-02 02:18:08 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 07:57:20 -0700 |
commit | 1651e14e28a2d9f446018ef522882e0709a2ce4f (patch) | |
tree | 401ff78624fdc4b445f3f95174a223acaf6a4ca0 /include | |
parent | 0437eb594e6e5e699248f865482e61034be846d0 (diff) | |
download | kernel_samsung_smdk4412-1651e14e28a2d9f446018ef522882e0709a2ce4f.zip kernel_samsung_smdk4412-1651e14e28a2d9f446018ef522882e0709a2ce4f.tar.gz kernel_samsung_smdk4412-1651e14e28a2d9f446018ef522882e0709a2ce4f.tar.bz2 |
[PATCH] namespaces: incorporate fs namespace into nsproxy
This moves the mount namespace into the nsproxy. The mount namespace count
now refers to the number of nsproxies point to it, rather than the number of
tasks. As a result, the unshare_namespace() function in kernel/fork.c no
longer checks whether it is being shared.
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andrey Savochkin <saw@sw.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/init_task.h | 1 | ||||
-rw-r--r-- | include/linux/namespace.h | 6 | ||||
-rw-r--r-- | include/linux/nsproxy.h | 3 | ||||
-rw-r--r-- | include/linux/sched.h | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 8f8bb42..4865348 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -72,6 +72,7 @@ extern struct nsproxy init_nsproxy; #define INIT_NSPROXY(nsproxy) { \ .count = ATOMIC_INIT(1), \ .nslock = SPIN_LOCK_UNLOCKED, \ + .namespace = NULL, \ } #define INIT_SIGHAND(sighand) { \ diff --git a/include/linux/namespace.h b/include/linux/namespace.h index 3abc8e3..d137009 100644 --- a/include/linux/namespace.h +++ b/include/linux/namespace.h @@ -4,6 +4,7 @@ #include <linux/mount.h> #include <linux/sched.h> +#include <linux/nsproxy.h> struct namespace { atomic_t count; @@ -26,11 +27,8 @@ static inline void put_namespace(struct namespace *namespace) static inline void exit_namespace(struct task_struct *p) { - struct namespace *namespace = p->namespace; + struct namespace *namespace = p->nsproxy->namespace; if (namespace) { - task_lock(p); - p->namespace = NULL; - task_unlock(p); put_namespace(namespace); } } diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h index 7bdebfa..7ebe666 100644 --- a/include/linux/nsproxy.h +++ b/include/linux/nsproxy.h @@ -4,6 +4,8 @@ #include <linux/spinlock.h> #include <linux/sched.h> +struct namespace; + /* * A structure to contain pointers to all per-process * namespaces - fs (mount), uts, network, sysvipc, etc. @@ -19,6 +21,7 @@ struct nsproxy { atomic_t count; spinlock_t nslock; + struct namespace *namespace; }; extern struct nsproxy init_nsproxy; diff --git a/include/linux/sched.h b/include/linux/sched.h index 4fa631f..670b89a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -238,7 +238,6 @@ extern signed long schedule_timeout_interruptible(signed long timeout); extern signed long schedule_timeout_uninterruptible(signed long timeout); asmlinkage void schedule(void); -struct namespace; struct nsproxy; /* Maximum number of active map areas.. This is a random (large) number */ @@ -897,8 +896,7 @@ struct task_struct { struct fs_struct *fs; /* open file information */ struct files_struct *files; -/* namespace */ - struct namespace *namespace; +/* namespaces */ struct nsproxy *nsproxy; /* signal handlers */ struct signal_struct *signal; |