linux-stable/net/core
Pavel Emelyanov dec827d174 [NETNS]: The generic per-net pointers.
Add the elastic array of void * pointer to the struct net.
The access rules are simple:

 1. register the ops with register_pernet_gen_device to get
    the id of your private pointer
 2. call net_assign_generic() to put the private data on the
    struct net (most preferably this should be done in the
    ->init callback of the ops registered)
 3. do not store any private reference on the net_generic array;
 4. do not change this pointer while the net is alive;
 5. use the net_generic() to get the pointer.

When adding a new pointer, I copy the old array, replace it
with a new one and schedule the old for kfree after an RCU
grace period.

Since the net_generic explores the net->gen array inside rcu
read section and once set the net->gen->ptr[x] pointer never 
changes, this grants us a safe access to generic pointers.

Quoting Paul: "... RCU is protecting -only- the net_generic 
structure that net_generic() is traversing, and the [pointer]
returned by net_generic() is protected by a reference counter 
in the upper-level struct net."

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-04-15 00:36:08 -07:00
..
datagram.c [NET] CORE: Introducing new memory accounting interface. 2008-01-28 15:00:18 -08:00
dev.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-03-27 18:48:56 -07:00
dev_mcast.c [NET]: Use existing device list walker for /proc/dev_mcast. 2008-02-29 11:44:14 -08:00
dst.c [NET]: uninline dst_release 2008-03-27 17:53:31 -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 [NET] NETNS: Omit sock->sk_net without CONFIG_NET_NS. 2008-03-26 04:39:55 +09:00
filter.c [SKFILTER]: Add SKF_ADF_NLATTR instruction 2008-04-10 02:02:28 -07:00
flow.c [IPSEC] flow: reorder "struct flow_cache_entry" and remove SLAB_HWCACHE_ALIGN 2008-02-07 23:30:42 -08:00
gen_estimator.c [NET_SCHED]: Convert packet schedulers from rtnetlink to new netlink API 2008-01-28 15:11:10 -08:00
gen_stats.c [NET_SCHED]: Convert packet schedulers from rtnetlink to new netlink API 2008-01-28 15:11:10 -08:00
iovec.c
kmap_skb.h
link_watch.c
Makefile [NET]: Fix running without sysfs 2007-10-10 16:52:46 -07:00
neighbour.c [NET] NEIGHBOUR: Extract hash/lookup functions for pneigh entries. 2008-03-28 13:43:16 +09:00
net-sysfs.c [ETH]: Combine format_addr() with print_mac(). 2008-01-28 15:00:05 -08:00
net-sysfs.h [NET]: Remove in-code externs for some functions from net/core/dev.c 2007-10-23 21:27:56 -07:00
net_namespace.c [NETNS]: The generic per-net pointers. 2008-04-15 00:36:08 -07:00
netevent.c [NET]: net/core/netevent.c should #include <net/netevent.h> 2007-07-05 17:40:27 -07:00
netpoll.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-03-21 03:42:24 -07:00
pktgen.c [NET] NETNS: Omit net_device->nd_net without CONFIG_NET_NS. 2008-03-26 04:39:53 +09:00
request_sock.c [NET] net/core/request_sock.c: Remove unused exports. 2008-01-28 14:54:33 -08:00
rtnetlink.c [NET] NETNS: Omit sock->sk_net without CONFIG_NET_NS. 2008-03-26 04:39:55 +09:00
scm.c [NET]: Fix function put_cmsg() which may cause usr application memory overflow 2007-12-20 14:36:44 -08:00
skbuff.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2008-04-14 02:30:23 -07:00
sock.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2008-04-14 02:30:23 -07:00
stream.c [NET] CORE: Introducing new memory accounting interface. 2008-01-28 15:00:18 -08:00
sysctl_net_core.c [NETNS]: Introduce a netns_core structure. 2008-03-31 19:41:14 -07:00
user_dma.c
utils.c [NET] core/utils.c: digit2bin is dead static inline 2008-01-28 15:01:58 -08:00