summaryrefslogtreecommitdiff
path: root/net/devlink/core.c
diff options
context:
space:
mode:
authorJames Chapman <jchapman@katalix.com>2024-07-29 16:38:06 +0100
committerDavid S. Miller <davem@davemloft.net>2024-07-31 09:25:13 +0100
commit29717a4fb7fcbbcfa5f0d5e8969b8ce0929276be (patch)
tree3484170c58c46b6bb2fcc635295acecf22b0608b /net/devlink/core.c
parent0fa51a7c6f54f1c0c23bb256eb9b2d31a8b9c544 (diff)
downloadlwn-29717a4fb7fcbbcfa5f0d5e8969b8ce0929276be.tar.gz
lwn-29717a4fb7fcbbcfa5f0d5e8969b8ce0929276be.zip
l2tp: simplify tunnel and socket cleanup
When the l2tp tunnel socket used sk_user_data to point to its associated l2tp tunnel, socket and tunnel cleanup had to make use of the socket's destructor to free the tunnel only when the socket could no longer be accessed. Now that sk_user_data is no longer used, we can simplify socket and tunnel cleanup: * If the tunnel closes first, it cleans up and drops its socket ref when the tunnel refcount drops to zero. If its socket was provided by userspace, the socket is closed and freed asynchronously, when userspace closes it. If its socket is a kernel socket, the tunnel closes the socket itself during cleanup and drops its socket ref when the tunnel's refcount drops to zero. * If the socket closes first, we initiate the closing of its associated tunnel. For UDP sockets, this is via the socket's encap_destroy hook. For L2TPIP sockets, this is via the socket's destroy callback. The tunnel holds a socket ref while it references the sock. When the tunnel is freed, it drops its socket ref and the socket will be cleaned up when its own refcount drops to zero, asynchronous to the tunnel free. * The tunnel socket destructor is no longer needed since the tunnel is no longer freed through the socket destructor. 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>
Diffstat (limited to 'net/devlink/core.c')
0 files changed, 0 insertions, 0 deletions