Skip to content

Commit 5dfa598

Browse files
j-c-hdavem330
authored andcommitted
l2tp: use pre_exit pernet hook to avoid rcu_barrier
Move the work of closing all tunnels from the pernet exit hook to pre_exit since the core does rcu synchronisation between these steps and we can therefore remove rcu_barrier from l2tp code. Signed-off-by: James Chapman <[email protected]> Signed-off-by: Tom Parkin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d93b8a6 commit 5dfa598

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

net/l2tp/l2tp_core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,7 @@ static __net_init int l2tp_init_net(struct net *net)
17561756
return 0;
17571757
}
17581758

1759-
static __net_exit void l2tp_exit_net(struct net *net)
1759+
static __net_exit void l2tp_pre_exit_net(struct net *net)
17601760
{
17611761
struct l2tp_net *pn = l2tp_pernet(net);
17621762
struct l2tp_tunnel *tunnel = NULL;
@@ -1771,7 +1771,11 @@ static __net_exit void l2tp_exit_net(struct net *net)
17711771

17721772
if (l2tp_wq)
17731773
drain_workqueue(l2tp_wq);
1774-
rcu_barrier();
1774+
}
1775+
1776+
static __net_exit void l2tp_exit_net(struct net *net)
1777+
{
1778+
struct l2tp_net *pn = l2tp_pernet(net);
17751779

17761780
idr_destroy(&pn->l2tp_v2_session_idr);
17771781
idr_destroy(&pn->l2tp_v3_session_idr);
@@ -1781,6 +1785,7 @@ static __net_exit void l2tp_exit_net(struct net *net)
17811785
static struct pernet_operations l2tp_net_ops = {
17821786
.init = l2tp_init_net,
17831787
.exit = l2tp_exit_net,
1788+
.pre_exit = l2tp_pre_exit_net,
17841789
.id = &l2tp_net_id,
17851790
.size = sizeof(struct l2tp_net),
17861791
};

0 commit comments

Comments
 (0)