linux/net/core
Pavel Emelyanov cf7b708c8d Make access to task's nsproxy lighter
When someone wants to deal with some other taks's namespaces it has to lock
the task and then to get the desired namespace if the one exists.  This is
slow on read-only paths and may be impossible in some cases.

E.g.  Oleg recently noticed a race between unshare() and the (sent for
review in cgroups) pid namespaces - when the task notifies the parent it
has to know the parent's namespace, but taking the task_lock() is
impossible there - the code is under write locked tasklist lock.

On the other hand switching the namespace on task (daemonize) and releasing
the namespace (after the last task exit) is rather rare operation and we
can sacrifice its speed to solve the issues above.

The access to other task namespaces is proposed to be performed
like this:

     rcu_read_lock();
     nsproxy = task_nsproxy(tsk);
     if (nsproxy != NULL) {
             / *
               * work with the namespaces here
               * e.g. get the reference on one of them
               * /
     } / *
         * NULL task_nsproxy() means that this task is
         * almost dead (zombie)
         * /
     rcu_read_unlock();

This patch has passed the review by Eric and Oleg :) and,
of course, tested.

[clg@fr.ibm.com: fix unshare()]
[ebiederm@xmission.com: Update get_net_ns_by_pid]
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-19 11:53:37 -07:00
..
Makefile [NET]: Fix running without sysfs 2007-10-10 16:52:46 -07:00
datagram.c [NET]: Do not dereference iov if length is zero 2007-09-11 10:29:07 +02:00
dev.c [NET]: Avoid copying TCP packets unnecessarily 2007-10-15 12:26:34 -07:00
dev_mcast.c [NETNS]: Move some code into __init section when CONFIG_NET_NS=n 2007-10-10 16:54:58 -07:00
dst.c [NET]: Make the loopback device per network namespace. 2007-10-10 16:52:49 -07:00
ethtool.c [ETHTOOL] Provide default behaviors for a few ethtool sub-ioctls 2007-10-10 16:51:17 -07:00
fib_rules.c [IPV4/IPV6/DECNET]: Small cleanup for fib rules. 2007-10-10 16:51:22 -07:00
filter.c [NET]: Fix the race between sk_filter_(de|at)tach and sk_clone() 2007-10-17 21:22:42 -07:00
flow.c mm: Remove slab destructors from kmem_cache_create(). 2007-07-20 10:11:58 +09:00
gen_estimator.c [NET]: gen_estimator deadlock fix 2007-07-18 01:46:50 -07:00
gen_stats.c [SK_BUFF]: Convert skb->tail to sk_buff_data_t 2007-04-25 22:26:28 -07:00
iovec.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
kmap_skb.h
link_watch.c [NET] link_watch: Always schedule urgent events 2007-05-10 23:45:28 -07:00
neighbour.c sysctl: fix neighbour table sysctls. 2007-10-18 14:37:22 -07:00
net-sysfs.c Driver core: change add_uevent_var to use a struct 2007-10-12 14:51:01 -07:00
net_namespace.c [NETNS]: Don't memset() netns to zero manually 2007-10-10 16:54:59 -07:00
netevent.c [NET]: net/core/netevent.c should #include <net/netevent.h> 2007-07-05 17:40:27 -07:00
netpoll.c [NET]: Wrap netdevice hardware header creation. 2007-10-10 16:52:50 -07:00
pktgen.c [IPSEC]: Rename mode to outer_mode and add inner_mode 2007-10-17 21:35:51 -07:00
request_sock.c
rtnetlink.c Make access to task's nsproxy lighter 2007-10-19 11:53:37 -07:00
scm.c [NET]: sparse warning fixes 2007-10-10 16:54:48 -07:00
skbuff.c [NET]: Fix csum_start update in pskb_expand_head 2007-10-15 12:26:33 -07:00
sock.c [NET]: Move the filter releasing into a separate call 2007-10-17 21:21:51 -07:00
stream.c
sysctl_net_core.c [XFRM]: Allow XFRM_ACQ_EXPIRES to be tunable via sysctl. 2007-05-31 01:23:23 -07:00
user_dma.c [NET]: Revert sk_buff walker cleanups. 2007-04-27 15:21:23 -07:00
utils.c [NET] net/core/utils: fix sparse warning 2007-08-07 18:02:43 -07:00