diff options
| author | David S. Miller <davem@davemloft.net> | 2015-03-12 14:39:44 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-03-12 14:39:44 -0400 |
| commit | 20453d88ccb6eb269787f37181202625fc12ccdc (patch) | |
| tree | da550b771a52ba583eb97c1ad00fffbf3ae17f73 /include/linux | |
| parent | 6c7005f6cb1bf63bb1f505ef69364fb2cc00628e (diff) | |
| parent | 0c5c9fb55106333e773de8c9dd321fa8240caeb3 (diff) | |
Merge branch 'possible_net_t'
Eric W. Biederman says:
====================
Introduce possible_net_t
The current usage of write_pnet and read_pnet is a little laborious and
error prone as you only notice if you failed to include them if are
compiling with network namespaces enabled.
possible_net_t remedies that by using a type that is 0 bytes when
network namespaces are disabled and can only be read and written to with
read_pnet and write_pnet.
Aka less work and safer for the same effect.
I kill hold_net and release_net first as are they are haven't been used
since 2008 and are noise at the points where write_pnet and read_pnet
are used.
I have folded in Eric Dumazets suggestions to improve the killing of
hold_net and release net. And respon. I had to respin anyway as
there was enough changes elsewhere in the tree the previous version
of these patches did not quite apply cleanly.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/netdevice.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1354ae83efc8..ddab1a2a07a0 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1721,9 +1721,7 @@ struct net_device { struct netpoll_info __rcu *npinfo; #endif -#ifdef CONFIG_NET_NS - struct net *nd_net; -#endif + possible_net_t nd_net; /* mid-layer private */ union { @@ -1863,10 +1861,7 @@ struct net *dev_net(const struct net_device *dev) static inline void dev_net_set(struct net_device *dev, struct net *net) { -#ifdef CONFIG_NET_NS - release_net(dev->nd_net); - dev->nd_net = hold_net(net); -#endif + write_pnet(&dev->nd_net, net); } static inline bool netdev_uses_dsa(struct net_device *dev) |
