Re: [PATCHv4 net 1/3] bonding: move IPsec deletion to bond_ipsec_free_sa

2025-03-06 Thread Hangbin Liu
On Wed, Mar 05, 2025 at 04:12:18PM +, Cosmin Ratiu wrote: > +++ b/drivers/net/bonding/bond_main.c > @@ -613,8 +613,11 @@ static void bond_ipsec_del_sa_all(struct bonding > *bond) > > mutex_lock(&bond->ipsec_lock); > list_for_each_entry(ipsec, &bond->ipsec_list, list) { > -

Re: [PATCHv4 net 1/3] bonding: move IPsec deletion to bond_ipsec_free_sa

2025-03-06 Thread Hangbin Liu
On Thu, Mar 06, 2025 at 01:37:15PM +, Cosmin Ratiu wrote: > On Thu, 2025-03-06 at 10:02 +, Hangbin Liu wrote: > > > For bond_ipsec_add_sa_all(), I will move the xso.real_dev = > > > real_dev > > > after .xdo_dev_state_add() in case the following situation. > > xso.real_dev needs to be init

Re: [PATCHv4 net 1/3] bonding: move IPsec deletion to bond_ipsec_free_sa

2025-03-06 Thread Hangbin Liu
On Thu, Mar 06, 2025 at 10:02:34AM +, Hangbin Liu wrote: > > Set xs->xso.real_dev = NULL is a good idea. As we will break > > in bond_ipsec_del_sa()/bond_ipsec_free_sa() when there is no > > xs->xso.real_dev. > > > > For bond_ipsec_add_sa_all(), I will move the xso.real_dev = real_dev > > afte

Re: [PATCHv4 net 1/3] bonding: move IPsec deletion to bond_ipsec_free_sa

2025-03-06 Thread Cosmin Ratiu
On Thu, 2025-03-06 at 10:02 +, Hangbin Liu wrote: > > For bond_ipsec_add_sa_all(), I will move the xso.real_dev = > > real_dev > > after .xdo_dev_state_add() in case the following situation. xso.real_dev needs to be initialized before the call to xdo_dev_state_add, since many of the implementa

Re: [PATCHv4 net 1/3] bonding: move IPsec deletion to bond_ipsec_free_sa

2025-03-06 Thread Hangbin Liu
On Wed, Mar 05, 2025 at 04:12:18PM +, Cosmin Ratiu wrote: > On Wed, 2025-03-05 at 14:13 +, Hangbin Liu wrote: > > On Wed, Mar 05, 2025 at 10:38:36AM +0200, Nikolay Aleksandrov wrote: > > > > @@ -617,8 +614,18 @@ static void bond_ipsec_del_sa_all(struct > > > > bonding *bond) > > > >   > > >

Re: [PATCHv4 net 1/3] bonding: move IPsec deletion to bond_ipsec_free_sa

2025-03-06 Thread Hangbin Liu
On Thu, Mar 06, 2025 at 09:37:53AM +, Hangbin Liu wrote: > > > > The reason the mutex was added (instead of the spinlock used before) > > was exactly because the add and free offload operations could sleep. > > > > > With your reply, I also checked the xdo_dev_state_add() in > > > bond_ipsec_

Re: [PATCHv4 net 1/3] bonding: move IPsec deletion to bond_ipsec_free_sa

2025-03-05 Thread Cosmin Ratiu
On Wed, 2025-03-05 at 14:13 +, Hangbin Liu wrote: > On Wed, Mar 05, 2025 at 10:38:36AM +0200, Nikolay Aleksandrov wrote: > > > @@ -617,8 +614,18 @@ static void bond_ipsec_del_sa_all(struct > > > bonding *bond) > > >   > > >   mutex_lock(&bond->ipsec_lock); > > >   list_for_each_entry(ipsec, &bo

Re: [PATCHv4 net 1/3] bonding: move IPsec deletion to bond_ipsec_free_sa

2025-03-05 Thread Hangbin Liu
On Wed, Mar 05, 2025 at 10:38:36AM +0200, Nikolay Aleksandrov wrote: > > @@ -617,8 +614,18 @@ static void bond_ipsec_del_sa_all(struct bonding *bond) > > > > mutex_lock(&bond->ipsec_lock); > > list_for_each_entry(ipsec, &bond->ipsec_list, list) { > > Second time - you should use list_for

Re: [PATCHv4 net 1/3] bonding: move IPsec deletion to bond_ipsec_free_sa

2025-03-05 Thread Nikolay Aleksandrov
On 3/4/25 15:11, Hangbin Liu wrote: > The fixed commit placed mutex_lock() inside spin_lock_bh(), which triggers > a warning: > > BUG: sleeping function called from invalid context at... > > Fix this by moving the IPsec deletion operation to bond_ipsec_free_sa, > which is not held by spin_lock_

[PATCHv4 net 1/3] bonding: move IPsec deletion to bond_ipsec_free_sa

2025-03-04 Thread Hangbin Liu
The fixed commit placed mutex_lock() inside spin_lock_bh(), which triggers a warning: BUG: sleeping function called from invalid context at... Fix this by moving the IPsec deletion operation to bond_ipsec_free_sa, which is not held by spin_lock_bh(). Additionally, delete the IPsec list in bond