l2tp: delete sessions using work queue
authorJames Chapman <jchapman@katalix.com>
Mon, 29 Jul 2024 15:38:07 +0000 (16:38 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 Jul 2024 08:25:13 +0000 (09:25 +0100)
commitfc7ec7f554d7d0a27ba339fcf48df11d14413329
treeb79058b64b1edcb23ce289f793a908fcd68eeee0
parent29717a4fb7fcbbcfa5f0d5e8969b8ce0929276be
l2tp: delete sessions using work queue

When a tunnel is closed, l2tp_tunnel_closeall closes all sessions in
the tunnel. Move the work of deleting each session to the work queue
so that sessions are deleted using the same codepath whether they are
closed by user API request or their parent tunnel is closing. This
also avoids the locking dance in l2tp_tunnel_closeall where the
tunnel's session list lock was unlocked and relocked in the loop.

In l2tp_exit_net, use drain_workqueue instead of flush_workqueue
because the processing of tunnel_delete work may queue session_delete
work items which must also be processed.

Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/l2tp/l2tp_core.c
net/l2tp/l2tp_core.h