diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2011-08-27 09:43:54 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2011-08-27 10:06:11 -0400 |
commit | 7b1bb388bc879ffcc6c69b567816d5c354afe42b (patch) | |
tree | 5a217fdfb0b5e5a327bdcd624506337c1ae1fe32 /kernel/nsproxy.c | |
parent | 7d754596756240fa918b94cd0c3011c77a638987 (diff) | |
parent | 02f8c6aee8df3cdc935e9bdd4f2d020306035dbe (diff) |
Merge 'Linux v3.0' into Litmus
Some notes:
* Litmus^RT scheduling class is the topmost scheduling class
(above stop_sched_class).
* scheduler_ipi() function (e.g., in smp_reschedule_interrupt())
may increase IPI latencies.
* Added path into schedule() to quickly re-evaluate scheduling
decision without becoming preemptive again. This used to be
a standard path before the removal of BKL.
Conflicts:
Makefile
arch/arm/kernel/calls.S
arch/arm/kernel/smp.c
arch/x86/include/asm/unistd_32.h
arch/x86/kernel/smp.c
arch/x86/kernel/syscall_table_32.S
include/linux/hrtimer.h
kernel/printk.c
kernel/sched.c
kernel/sched_fair.c
Diffstat (limited to 'kernel/nsproxy.c')
-rw-r--r-- | kernel/nsproxy.c | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index f74e6c00e26d..d6a00f3de15d 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c | |||
@@ -22,6 +22,9 @@ | |||
22 | #include <linux/pid_namespace.h> | 22 | #include <linux/pid_namespace.h> |
23 | #include <net/net_namespace.h> | 23 | #include <net/net_namespace.h> |
24 | #include <linux/ipc_namespace.h> | 24 | #include <linux/ipc_namespace.h> |
25 | #include <linux/proc_fs.h> | ||
26 | #include <linux/file.h> | ||
27 | #include <linux/syscalls.h> | ||
25 | 28 | ||
26 | static struct kmem_cache *nsproxy_cachep; | 29 | static struct kmem_cache *nsproxy_cachep; |
27 | 30 | ||
@@ -69,13 +72,13 @@ static struct nsproxy *create_new_namespaces(unsigned long flags, | |||
69 | goto out_ns; | 72 | goto out_ns; |
70 | } | 73 | } |
71 | 74 | ||
72 | new_nsp->uts_ns = copy_utsname(flags, tsk->nsproxy->uts_ns); | 75 | new_nsp->uts_ns = copy_utsname(flags, tsk); |
73 | if (IS_ERR(new_nsp->uts_ns)) { | 76 | if (IS_ERR(new_nsp->uts_ns)) { |
74 | err = PTR_ERR(new_nsp->uts_ns); | 77 | err = PTR_ERR(new_nsp->uts_ns); |
75 | goto out_uts; | 78 | goto out_uts; |
76 | } | 79 | } |
77 | 80 | ||
78 | new_nsp->ipc_ns = copy_ipcs(flags, tsk->nsproxy->ipc_ns); | 81 | new_nsp->ipc_ns = copy_ipcs(flags, tsk); |
79 | if (IS_ERR(new_nsp->ipc_ns)) { | 82 | if (IS_ERR(new_nsp->ipc_ns)) { |
80 | err = PTR_ERR(new_nsp->ipc_ns); | 83 | err = PTR_ERR(new_nsp->ipc_ns); |
81 | goto out_ipc; | 84 | goto out_ipc; |
@@ -198,10 +201,6 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags, | |||
198 | goto out; | 201 | goto out; |
199 | } | 202 | } |
200 | 203 | ||
201 | err = ns_cgroup_clone(current, task_pid(current)); | ||
202 | if (err) | ||
203 | put_nsproxy(*new_nsp); | ||
204 | |||
205 | out: | 204 | out: |
206 | return err; | 205 | return err; |
207 | } | 206 | } |
@@ -233,6 +232,45 @@ void exit_task_namespaces(struct task_struct *p) | |||
233 | switch_task_namespaces(p, NULL); | 232 | switch_task_namespaces(p, NULL); |
234 | } | 233 | } |
235 | 234 | ||
235 | SYSCALL_DEFINE2(setns, int, fd, int, nstype) | ||
236 | { | ||
237 | const struct proc_ns_operations *ops; | ||
238 | struct task_struct *tsk = current; | ||
239 | struct nsproxy *new_nsproxy; | ||
240 | struct proc_inode *ei; | ||
241 | struct file *file; | ||
242 | int err; | ||
243 | |||
244 | if (!capable(CAP_SYS_ADMIN)) | ||
245 | return -EPERM; | ||
246 | |||
247 | file = proc_ns_fget(fd); | ||
248 | if (IS_ERR(file)) | ||
249 | return PTR_ERR(file); | ||
250 | |||
251 | err = -EINVAL; | ||
252 | ei = PROC_I(file->f_dentry->d_inode); | ||
253 | ops = ei->ns_ops; | ||
254 | if (nstype && (ops->type != nstype)) | ||
255 | goto out; | ||
256 | |||
257 | new_nsproxy = create_new_namespaces(0, tsk, tsk->fs); | ||
258 | if (IS_ERR(new_nsproxy)) { | ||
259 | err = PTR_ERR(new_nsproxy); | ||
260 | goto out; | ||
261 | } | ||
262 | |||
263 | err = ops->install(new_nsproxy, ei->ns); | ||
264 | if (err) { | ||
265 | free_nsproxy(new_nsproxy); | ||
266 | goto out; | ||
267 | } | ||
268 | switch_task_namespaces(tsk, new_nsproxy); | ||
269 | out: | ||
270 | fput(file); | ||
271 | return err; | ||
272 | } | ||
273 | |||
236 | static int __init nsproxy_cache_init(void) | 274 | static int __init nsproxy_cache_init(void) |
237 | { | 275 | { |
238 | nsproxy_cachep = KMEM_CACHE(nsproxy, SLAB_PANIC); | 276 | nsproxy_cachep = KMEM_CACHE(nsproxy, SLAB_PANIC); |