Commit 7e4d784
net: hold netdev instance lock during rtnetlink operations
To preserve the atomicity, hold the lock while applying multiple
attributes. The major issue with a full conversion to the instance
lock are software nesting devices (bonding/team/vrf/etc). Those
devices call into the core stack for their lower (potentially
real hw) devices. To avoid explicitly wrapping all those places
into instance lock/unlock, introduce new API boundaries:
- (some) existing dev_xxx calls are now considered "external"
(to drivers) APIs and they transparently grab the instance
lock if needed (dev_api.c)
- new netif_xxx calls are internal core stack API (naming is
sketchy, I've tried netdev_xxx_locked per Jakub's suggestion,
but it feels a bit verbose; but happy to get back to this
naming scheme if this is the preference)
This avoids touching most of the existing ioctl/sysfs/drivers paths.
Note the special handling of ndo_xxx_slave operations: I exploit
the fact that none of the drivers that call these functions
need/use instance lock. At the same time, they use dev_xxx
APIs, so the lower device has to be unlocked.
Changes in unregister_netdevice_many_notify (to protect dev->state
with instance lock) trigger lockdep - the loop over close_list
(mostly from cleanup_net) introduces spurious ordering issues.
netdev_lock_cmp_fn has a justification on why it's ok to suppress
for now.
Cc: Saeed Mahameed <[email protected]>
Signed-off-by: Stanislav Fomichev <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>1 parent cae03e5 commit 7e4d784
File tree
6 files changed
+329
-150
lines changed- include/linux
- net/core
6 files changed
+329
-150
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2620 | 2620 | | |
2621 | 2621 | | |
2622 | 2622 | | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
2623 | 2638 | | |
2624 | 2639 | | |
2625 | 2640 | | |
2626 | 2641 | | |
2627 | 2642 | | |
| 2643 | + | |
2628 | 2644 | | |
2629 | 2645 | | |
2630 | 2646 | | |
2631 | 2647 | | |
2632 | 2648 | | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
2633 | 2652 | | |
2634 | 2653 | | |
2635 | 2654 | | |
| |||
2776 | 2795 | | |
2777 | 2796 | | |
2778 | 2797 | | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
2779 | 2804 | | |
2780 | 2805 | | |
2781 | 2806 | | |
| |||
3350 | 3375 | | |
3351 | 3376 | | |
3352 | 3377 | | |
| 3378 | + | |
3353 | 3379 | | |
| 3380 | + | |
3354 | 3381 | | |
3355 | 3382 | | |
3356 | 3383 | | |
| |||
4211 | 4238 | | |
4212 | 4239 | | |
4213 | 4240 | | |
| 4241 | + | |
| 4242 | + | |
4214 | 4243 | | |
4215 | 4244 | | |
| 4245 | + | |
4216 | 4246 | | |
4217 | 4247 | | |
4218 | | - | |
| 4248 | + | |
4219 | 4249 | | |
4220 | 4250 | | |
4221 | | - | |
4222 | 4251 | | |
4223 | | - | |
4224 | | - | |
4225 | | - | |
4226 | | - | |
| 4252 | + | |
4227 | 4253 | | |
4228 | 4254 | | |
4229 | 4255 | | |
4230 | 4256 | | |
4231 | 4257 | | |
4232 | 4258 | | |
| 4259 | + | |
| 4260 | + | |
4233 | 4261 | | |
4234 | 4262 | | |
4235 | 4263 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
0 commit comments