Commit bd11ff4
ipv6: Get rid of RTNL for SIOCDELRT and RTM_DELROUTE.
Basically, removing an IPv6 route does not require RTNL because
the IPv6 routing tables are protected by per table lock.
inet6_rtm_delroute() calls nexthop_find_by_id() to check if the
nexthop specified by RTA_NH_ID exists. nexthop uses rbtree and
the top-down walk can be safely performed under RCU.
ip6_route_del() already relies on RCU and the table lock, but we
need to extend the RCU critical section a bit more to cover
__ip6_del_rt(). For example, nexthop_for_each_fib6_nh() and
inet6_rt_notify() needs RCU.
Let's call nexthop_find_by_id() and __ip6_del_rt() under RCU and
get rid of RTNL from inet6_rtm_delroute() and SIOCDELRT.
Even if the nexthop is removed after rcu_read_unlock() in
inet6_rtm_delroute(), __remove_nexthop_fib() cleans up the routes
tied to the nexthop, and ip6_route_del() returns -ESRCH. So the
request was at least valid as of nexthop_find_by_id(), and it's just
a matter of timing.
Note that we need to pass false to lwtunnel_valid_encap_type_attr().
The following patches also use the newroute bool.
Note also that fib6_get_table() does not require RCU because once
allocated fib6_table is not freed until netns dismantle. I will
post a follow-up series to convert such callers to RCU-lockless
version. [0]
Link: https://lore.kernel.org/netdev/20250417174557.65721-1-kuniyu@amazon.com/ #[0]
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250418000443.43734-3-kuniyu@amazon.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>1 parent 4cb4861 commit bd11ff4
1 file changed
+28
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4125 | 4125 | | |
4126 | 4126 | | |
4127 | 4127 | | |
4128 | | - | |
4129 | 4128 | | |
4130 | | - | |
| 4129 | + | |
| 4130 | + | |
4131 | 4131 | | |
4132 | 4132 | | |
4133 | 4133 | | |
| |||
4142 | 4142 | | |
4143 | 4143 | | |
4144 | 4144 | | |
4145 | | - | |
4146 | 4145 | | |
4147 | 4146 | | |
4148 | 4147 | | |
4149 | | - | |
4150 | | - | |
4151 | | - | |
| 4148 | + | |
| 4149 | + | |
| 4150 | + | |
| 4151 | + | |
4152 | 4152 | | |
4153 | 4153 | | |
4154 | 4154 | | |
| |||
4517 | 4517 | | |
4518 | 4518 | | |
4519 | 4519 | | |
4520 | | - | |
4521 | 4520 | | |
4522 | 4521 | | |
| 4522 | + | |
4523 | 4523 | | |
4524 | 4524 | | |
4525 | 4525 | | |
4526 | 4526 | | |
| 4527 | + | |
4527 | 4528 | | |
4528 | 4529 | | |
4529 | 4530 | | |
4530 | 4531 | | |
4531 | 4532 | | |
4532 | | - | |
| 4533 | + | |
4533 | 4534 | | |
4534 | 4535 | | |
4535 | 4536 | | |
| |||
5052 | 5053 | | |
5053 | 5054 | | |
5054 | 5055 | | |
5055 | | - | |
| 5056 | + | |
| 5057 | + | |
5056 | 5058 | | |
5057 | 5059 | | |
5058 | 5060 | | |
| |||
5086 | 5088 | | |
5087 | 5089 | | |
5088 | 5090 | | |
5089 | | - | |
| 5091 | + | |
5090 | 5092 | | |
5091 | 5093 | | |
5092 | 5094 | | |
5093 | 5095 | | |
5094 | 5096 | | |
5095 | 5097 | | |
5096 | | - | |
| 5098 | + | |
5097 | 5099 | | |
| 5100 | + | |
5098 | 5101 | | |
5099 | 5102 | | |
5100 | 5103 | | |
| |||
5203 | 5206 | | |
5204 | 5207 | | |
5205 | 5208 | | |
5206 | | - | |
| 5209 | + | |
5207 | 5210 | | |
5208 | 5211 | | |
5209 | 5212 | | |
| |||
5223 | 5226 | | |
5224 | 5227 | | |
5225 | 5228 | | |
5226 | | - | |
| 5229 | + | |
5227 | 5230 | | |
5228 | 5231 | | |
5229 | 5232 | | |
| |||
5546 | 5549 | | |
5547 | 5550 | | |
5548 | 5551 | | |
5549 | | - | |
5550 | | - | |
5551 | | - | |
5552 | | - | |
| 5552 | + | |
| 5553 | + | |
| 5554 | + | |
| 5555 | + | |
| 5556 | + | |
| 5557 | + | |
| 5558 | + | |
| 5559 | + | |
| 5560 | + | |
5553 | 5561 | | |
5554 | 5562 | | |
5555 | | - | |
| 5563 | + | |
5556 | 5564 | | |
5557 | | - | |
| 5565 | + | |
5558 | 5566 | | |
5559 | 5567 | | |
5560 | 5568 | | |
| |||
6766 | 6774 | | |
6767 | 6775 | | |
6768 | 6776 | | |
6769 | | - | |
| 6777 | + | |
6770 | 6778 | | |
6771 | 6779 | | |
6772 | 6780 | | |
| |||
0 commit comments