Skip to content

Commit

Permalink
subflow: wake parent mptcp socket on subflow state change
Browse files Browse the repository at this point in the history
We need to wakeup readers blocking for POLLIN, as no
more data will arrive they will never be awoken otherwise.

This is needed at least until proper MPTCP-Level fin/reset
signalling gets added.

Signed-off-by: Florian Westphal <[email protected]>
  • Loading branch information
Florian Westphal authored and jenkins-tessares committed Nov 2, 2019
1 parent d9db33d commit c742ddc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,28 @@ static struct mptcp_subflow_context *subflow_create_ctx(struct sock *sk,
return ctx;
}

static void __subflow_state_change(struct sock *sk)
{
struct socket_wq *wq;

rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
wake_up_interruptible_all(&wq->wait);
rcu_read_unlock();
}

static void subflow_state_change(struct sock *sk)
{
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct sock *parent = subflow->conn;

__subflow_state_change(sk);

if (parent)
__subflow_state_change(parent);
}

static int subflow_ulp_init(struct sock *sk)
{
struct inet_connection_sock *icsk = inet_csk(sk);
Expand Down Expand Up @@ -750,6 +772,7 @@ static int subflow_ulp_init(struct sock *sk)
ctx->tcp_sk_data_ready = sk->sk_data_ready;
sk->sk_data_ready = subflow_data_ready;
sk->sk_write_space = subflow_write_space;
sk->sk_state_change = subflow_state_change;
out:
return err;
}
Expand Down

0 comments on commit c742ddc

Please sign in to comment.