[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180212184837.GC1422@alphalink.fr>
Date: Mon, 12 Feb 2018 19:48:37 +0100
From: Guillaume Nault <g.nault@...halink.fr>
To: James Chapman <jchapman@...alix.com>
Cc: netdev@...r.kernel.org, kbuild-all@...org
Subject: Re: [PATCH net-next v2 04/16] l2tp: refactor tunnel lifetime
handling wrt its socket
On Mon, Feb 12, 2018 at 10:11:08AM +0000, James Chapman wrote:
> Ensure that the tunnel's socket is always extant while the tunnel
> object exists. Hold a ref on the socket until the tunnel is destroyed
> and ensure that all tunnel destroy paths go through a common function
> (l2tp_tunnel_delete).
>
> Since the tunnel's socket is now guaranteed to exist if the tunnel
> exists, we no longer need to use sockfd_lookup via l2tp_sock_to_tunnel
> to derive the tunnel from the socket since this is always
> sk_user_data.
>
> The tunnel object gains a new closing flag which is protected by a
> spinlock. The existing dead flag which is accessed using
> test_and_set_bit APIs is no longer used so is removed.
>
> --- a/net/l2tp/l2tp_core.c
> +++ b/net/l2tp/l2tp_core.c
> @@ -193,6 +148,12 @@ static void l2tp_tunnel_sock_put(struct sock *sk)
> return &tunnel->session_hlist[hash_32(session_id, L2TP_HASH_BITS)];
> }
>
> +void l2tp_tunnel_free(struct l2tp_tunnel *tunnel)
> +{
> + sock_put(tunnel->sock);
> + /* the tunnel is freed in the socket destructor */
> +}
> +
EXPORT_SYMBOL_GPL(l2tp_tunnel_free) is missing.
Powered by blists - more mailing lists