Commit 8e34671
net: bonding: use atomic instead of rtnl_mutex, to make sure peer notify updated
Using atomic to protect the send_peer_notif instead of rtnl_mutex.
This approach allows safe updates in both interrupt and process
contexts, while avoiding code complexity.
In lacp mode, the rtnl might be locked, preventing ad_cond_set_peer_notif()
from acquiring the lock and updating send_peer_notif. This patch addresses
the issue by using a atomic. Since updating send_peer_notif does not
require high real-time performance, such atomic updates are acceptable.
After coverting the rtnl lock for send_peer_notif to atomic, in bond_mii_monitor(),
we should check the should_notify_peers (rtnllock required) instead of
send_peer_notif. By the way, to avoid peer notify event loss, we check
again whether to send peer notify, such as active-backup mode failover.
Cc: Jay Vosburgh <jv@jvosburgh.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: Nikolay Aleksandrov <razor@blackwall.org>
Cc: Hangbin Liu <liuhangbin@gmail.com>
Suggested-by: Jay Vosburgh <jv@jvosburgh.net>
Signed-off-by: Tonghao Zhang <tonghao@bamaicloud.com>
Signed-off-by: NipaLocal <nipa@local>1 parent c9a5d4a commit 8e34671
File tree
3 files changed
+32
-30
lines changed- drivers/net/bonding
- include/net
3 files changed
+32
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
999 | 999 | | |
1000 | 1000 | | |
1001 | 1001 | | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
| 1002 | + | |
| 1003 | + | |
1007 | 1004 | | |
1008 | 1005 | | |
1009 | 1006 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1167 | 1167 | | |
1168 | 1168 | | |
1169 | 1169 | | |
| 1170 | + | |
1170 | 1171 | | |
1171 | | - | |
1172 | | - | |
1173 | | - | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1174 | 1175 | | |
1175 | 1176 | | |
1176 | 1177 | | |
| |||
1270 | 1271 | | |
1271 | 1272 | | |
1272 | 1273 | | |
1273 | | - | |
1274 | | - | |
1275 | 1274 | | |
1276 | 1275 | | |
1277 | 1276 | | |
| |||
1280 | 1279 | | |
1281 | 1280 | | |
1282 | 1281 | | |
1283 | | - | |
1284 | | - | |
1285 | | - | |
1286 | | - | |
1287 | | - | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
1288 | 1290 | | |
1289 | 1291 | | |
1290 | 1292 | | |
1291 | | - | |
1292 | | - | |
1293 | | - | |
1294 | | - | |
1295 | | - | |
1296 | 1293 | | |
1297 | 1294 | | |
1298 | 1295 | | |
| |||
2801 | 2798 | | |
2802 | 2799 | | |
2803 | 2800 | | |
2804 | | - | |
| 2801 | + | |
2805 | 2802 | | |
2806 | 2803 | | |
2807 | 2804 | | |
| |||
2816 | 2813 | | |
2817 | 2814 | | |
2818 | 2815 | | |
2819 | | - | |
2820 | | - | |
2821 | | - | |
2822 | | - | |
2823 | | - | |
2824 | | - | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
2825 | 2819 | | |
2826 | 2820 | | |
2827 | 2821 | | |
2828 | 2822 | | |
| 2823 | + | |
| 2824 | + | |
2829 | 2825 | | |
2830 | 2826 | | |
2831 | 2827 | | |
| |||
3773 | 3769 | | |
3774 | 3770 | | |
3775 | 3771 | | |
3776 | | - | |
| 3772 | + | |
3777 | 3773 | | |
3778 | 3774 | | |
3779 | 3775 | | |
| |||
4267 | 4263 | | |
4268 | 4264 | | |
4269 | 4265 | | |
| 4266 | + | |
| 4267 | + | |
4270 | 4268 | | |
4271 | 4269 | | |
4272 | 4270 | | |
| |||
4300 | 4298 | | |
4301 | 4299 | | |
4302 | 4300 | | |
4303 | | - | |
| 4301 | + | |
4304 | 4302 | | |
4305 | 4303 | | |
4306 | 4304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| |||
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
817 | 824 | | |
0 commit comments