diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2006-10-02 05:18:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:20 -0400 |
commit | 1651e14e28a2d9f446018ef522882e0709a2ce4f (patch) | |
tree | 401ff78624fdc4b445f3f95174a223acaf6a4ca0 /include | |
parent | 0437eb594e6e5e699248f865482e61034be846d0 (diff) |
[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 8f8bb422a5c7..4865348ca8bd 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -72,6 +72,7 @@ extern struct nsproxy init_nsproxy; | |||
72 | #define INIT_NSPROXY(nsproxy) { \ | 72 | #define INIT_NSPROXY(nsproxy) { \ |
73 | .count = ATOMIC_INIT(1), \ | 73 | .count = ATOMIC_INIT(1), \ |
74 | .nslock = SPIN_LOCK_UNLOCKED, \ | 74 | .nslock = SPIN_LOCK_UNLOCKED, \ |
75 | .namespace = NULL, \ | ||
75 | } | 76 | } |
76 | 77 | ||
77 | #define INIT_SIGHAND(sighand) { \ | 78 | #define INIT_SIGHAND(sighand) { \ |
diff --git a/include/linux/namespace.h b/include/linux/namespace.h index 3abc8e3b4879..d137009f0b2b 100644 --- a/include/linux/namespace.h +++ b/include/linux/namespace.h | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | #include <linux/mount.h> | 5 | #include <linux/mount.h> |
6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
7 | #include <linux/nsproxy.h> | ||
7 | 8 | ||
8 | struct namespace { | 9 | struct namespace { |
9 | atomic_t count; | 10 | atomic_t count; |
@@ -26,11 +27,8 @@ static inline void put_namespace(struct namespace *namespace) | |||
26 | 27 | ||
27 | static inline void exit_namespace(struct task_struct *p) | 28 | static inline void exit_namespace(struct task_struct *p) |
28 | { | 29 | { |
29 | struct namespace *namespace = p->namespace; | 30 | struct namespace *namespace = p->nsproxy->namespace; |
30 | if (namespace) { | 31 | if (namespace) { |
31 | task_lock(p); | ||
32 | p->namespace = NULL; | ||
33 | task_unlock(p); | ||
34 | put_namespace(namespace); | 32 | put_namespace(namespace); |
35 | } | 33 | } |
36 | } | 34 | } |
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h index 7bdebfaab6a5..7ebe66670c59 100644 --- a/include/linux/nsproxy.h +++ b/include/linux/nsproxy.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
5 | #include <linux/sched.h> | 5 | #include <linux/sched.h> |
6 | 6 | ||
7 | struct namespace; | ||
8 | |||
7 | /* | 9 | /* |
8 | * A structure to contain pointers to all per-process | 10 | * A structure to contain pointers to all per-process |
9 | * namespaces - fs (mount), uts, network, sysvipc, etc. | 11 | * namespaces - fs (mount), uts, network, sysvipc, etc. |
@@ -19,6 +21,7 @@ | |||
19 | struct nsproxy { | 21 | struct nsproxy { |
20 | atomic_t count; | 22 | atomic_t count; |
21 | spinlock_t nslock; | 23 | spinlock_t nslock; |
24 | struct namespace *namespace; | ||
22 | }; | 25 | }; |
23 | extern struct nsproxy init_nsproxy; | 26 | extern struct nsproxy init_nsproxy; |
24 | 27 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4fa631fa55e3..670b89a20070 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -238,7 +238,6 @@ extern signed long schedule_timeout_interruptible(signed long timeout); | |||
238 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | 238 | extern signed long schedule_timeout_uninterruptible(signed long timeout); |
239 | asmlinkage void schedule(void); | 239 | asmlinkage void schedule(void); |
240 | 240 | ||
241 | struct namespace; | ||
242 | struct nsproxy; | 241 | struct nsproxy; |
243 | 242 | ||
244 | /* Maximum number of active map areas.. This is a random (large) number */ | 243 | /* Maximum number of active map areas.. This is a random (large) number */ |
@@ -897,8 +896,7 @@ struct task_struct { | |||
897 | struct fs_struct *fs; | 896 | struct fs_struct *fs; |
898 | /* open file information */ | 897 | /* open file information */ |
899 | struct files_struct *files; | 898 | struct files_struct *files; |
900 | /* namespace */ | 899 | /* namespaces */ |
901 | struct namespace *namespace; | ||
902 | struct nsproxy *nsproxy; | 900 | struct nsproxy *nsproxy; |
903 | /* signal handlers */ | 901 | /* signal handlers */ |
904 | struct signal_struct *signal; | 902 | struct signal_struct *signal; |