On Tue, 09 Jul 2019 20:39:24 -0700, John Fastabend wrote: > Jakub Kicinski wrote: > > On Mon, 08 Jul 2019 19:14:05 +0000, John Fastabend wrote: > > > @@ -287,6 +313,27 @@ static void tls_sk_proto_cleanup(struct sock *sk, > > > #endif > > > } > > > > > > +static void tls_sk_proto_unhash(struct sock *sk) > > > +{ > > > + struct inet_connection_sock *icsk = inet_csk(sk); > > > + long timeo = sock_sndtimeo(sk, 0); > > > + struct tls_context *ctx; > > > + > > > + if (unlikely(!icsk->icsk_ulp_data)) { > > > > Is this for when sockmap is stacked on top of TLS and TLS got removed > > without letting sockmap know? > > Right its a pattern I used on the sockmap side and put here. But > I dropped the patch to let sockmap stack on top of TLS because > it was more than a fix IMO. We could probably drop this check on > the other hand its harmless. I feel like this code is pretty complex I struggle to follow all the paths, so perhaps it'd be better to drop stuff that's not necessary to have a clearer picture. > > > + if (sk->sk_prot->unhash) > > > + sk->sk_prot->unhash(sk); > > > + } > > > + > > > + ctx = tls_get_ctx(sk); > > > + if (ctx->tx_conf == TLS_SW || ctx->rx_conf == TLS_SW) > > > + tls_sk_proto_cleanup(sk, ctx, timeo); > > > + icsk->icsk_ulp_data = NULL; > > > > I think close only starts checking if ctx is NULL in patch 6. > > Looks like some chunks of ctx checking/clearing got spread to > > patch 1 and some to patch 6. > > Yeah, I thought the patches were easier to read this way but > maybe not. Could add something in the commit log. Ack! Let me try to get a full grip of patches 2 and 6 and come back to this. > > > + tls_ctx_free_wq(ctx); > > > + > > > + if (ctx->unhash) > > > + ctx->unhash(sk); > > > +} > > > + > > > static void tls_sk_proto_close(struct sock *sk, long timeout) > > > { > > > struct tls_context *ctx = tls_get_ctx(sk);