alistair23-linux/net/ipv6
Wei Wang bbd63f06d1 ipv6: update fn_sernum after route is inserted to tree
fib6_add() logic currently calls fib6_add_1() to figure out what node
should be used for the newly added route and then call
fib6_add_rt2node() to insert the route to the node.
And during the call of fib6_add_1(), fn_sernum is updated for all nodes
that share the same prefix as the new route.
This does not have issue in the current code because reader thread will
not be able to access the tree while writer thread is inserting new
route to it. However, it is not the case once we transition to use RCU.
Reader thread could potentially see the new fn_sernum before the new
route is inserted. As a result, reader thread's route lookup will return
a stale route with the new fn_sernum.

In order to solve this issue, we remove all the update of fn_sernum in
fib6_add_1(), and instead, introduce a new function that updates fn_sernum
for all related nodes and call this functions once the route is
successfully inserted to the tree.
Also, smp_wmb() is used after a route is successfully inserted into the
fib tree and right before the updated of fn->sernum. And smp_rmb() is
used right after fn->sernum is accessed in rt6_get_cookie_safe(). This
is to guarantee that when the reader thread sees the new fn->sernum, the
new route is already inserted in the tree in memory.

Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-10-07 21:22:58 +01:00
..
ila netfilter: nf_hook_ops structs can be const 2017-07-31 19:10:44 +02:00
netfilter netfilter: xtables: add scheduling opportunity in get_counters 2017-09-08 18:55:27 +02:00
addrconf.c ipv6: replace dst_hold() with dst_hold_safe() in routing code 2017-10-07 21:22:58 +01:00
addrconf_core.c
addrlabel.c ipv6: addrlabel: per netns list 2017-09-19 16:32:23 -07:00
af_inet6.c ipv6: Add sysctl for per namespace flow label reflection 2017-08-24 18:05:43 -07:00
ah6.c
anycast.c
calipso.c
datagram.c
esp6.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-09-01 17:42:05 -07:00
esp6_offload.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-09-01 17:42:05 -07:00
exthdrs.c ipv6: sr: allow SRH insertion with arbitrary segments_left value 2017-08-07 14:16:21 -07:00
exthdrs_core.c net: ipv6: remove unused code in ipv6_find_hdr() 2017-10-05 21:53:02 -07:00
exthdrs_offload.c
fib6_notifier.c net: Add module reference to FIB notifiers 2017-09-01 20:33:42 -07:00
fib6_rules.c net: ipv6: avoid overhead when no custom FIB rules are installed 2017-08-08 21:40:08 -07:00
fou6.c
icmp.c net/ipv6: Convert icmpv6_push_pending_frames to void 2017-10-06 09:52:31 -07:00
inet6_connection_sock.c
inet6_hashtables.c net: ipv6: add second dif to inet6 socket lookups 2017-08-07 11:39:22 -07:00
ip6_checksum.c
ip6_fib.c ipv6: update fn_sernum after route is inserted to tree 2017-10-07 21:22:58 +01:00
ip6_flowlabel.c
ip6_gre.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-10-05 18:19:22 -07:00
ip6_icmp.c
ip6_input.c
ip6_offload.c
ip6_offload.h
ip6_output.c udp: consistently apply ufo or fragmentation 2017-08-10 09:52:12 -07:00
ip6_tunnel.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-10-05 18:19:22 -07:00
ip6_udp_tunnel.c
ip6_vti.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-10-05 18:19:22 -07:00
ip6mr.c rtnetlink: make rtnl_register accept a flags parameter 2017-08-09 16:57:38 -07:00
ipcomp6.c
ipv6_sockglue.c net-ipv6: add support for sockopt(SOL_IPV6, IPV6_FREEBIND) 2017-09-30 05:30:52 +01:00
Kconfig ipv6: sr: add helper functions for seg6local 2017-08-25 17:10:24 -07:00
Makefile ipv6: sr: define core operations for seg6local lightweight tunnel 2017-08-07 14:16:22 -07:00
mcast.c
mcast_snoop.c
mip6.c
ndisc.c neigh: increase queue_len_bytes to match wmem_default 2017-08-29 16:10:50 -07:00
netfilter.c
output_core.c ipv6: accept 64k - 1 packet length in ip6_find_1stfragopt() 2017-08-22 10:23:26 -07:00
ping.c net/ipv6: Convert icmpv6_push_pending_frames to void 2017-10-06 09:52:31 -07:00
proc.c
protocol.c
raw.c net: ipv6: add second dif to raw socket lookups 2017-08-07 11:39:22 -07:00
reassembly.c Revert "net: fix percpu memory leaks" 2017-09-03 11:01:05 -07:00
route.c ipv6: replace dst_hold() with dst_hold_safe() in routing code 2017-10-07 21:22:58 +01:00
seg6.c ipv6: sr: define core operations for seg6local lightweight tunnel 2017-08-07 14:16:22 -07:00
seg6_hmac.c ipv6: sr: Use ARRAY_SIZE macro 2017-09-01 18:35:23 -07:00
seg6_iptunnel.c ipv6: sr: add support for encapsulation of L2 frames 2017-08-25 17:10:23 -07:00
seg6_local.c ipv6: sr: remove duplicate routing header type check 2017-09-11 14:34:10 -07:00
sit.c ipv6: speedup ipv6 tunnels dismantle 2017-09-19 16:32:23 -07:00
syncookies.c ipv4: ipv6: initialize treq->txhash in cookie_v[46]_check() 2017-07-18 11:22:51 -07:00
sysctl_net_ipv6.c ipv6: Add sysctl for per namespace flow label reflection 2017-08-24 18:05:43 -07:00
tcp_ipv6.c tcp: fix a request socket leak 2017-09-08 16:07:17 -07:00
tcpv6_offload.c
tunnel6.c
udp.c udpv6: Fix the checksum computation when HW checksum does not apply 2017-09-18 11:43:03 -07:00
udp_impl.h
udp_offload.c net: avoid skb_warn_bad_offload false positives on UFO 2017-08-08 21:39:01 -07:00
udplite.c
xfrm6_input.c xfrm6: Fix CHECKSUM_COMPLETE after IPv6 header push 2017-08-02 11:00:15 +02:00
xfrm6_mode_beet.c
xfrm6_mode_ro.c
xfrm6_mode_transport.c
xfrm6_mode_tunnel.c
xfrm6_output.c
xfrm6_policy.c net: xfrm: support setting an output mark. 2017-08-11 07:03:00 +02:00
xfrm6_protocol.c
xfrm6_state.c
xfrm6_tunnel.c