Skip to content

Commit

Permalink
mptcp: cleanup state propagation.
Browse files Browse the repository at this point in the history
When propagating the first subflow state via the release_cb, the
msk must actually take to 2 separate actions: state sync-up and
send buffer sync-up. Relaying on the specific flags instead of
bounding both in __mptcp_sync_state(), allows cleaning up a bit
the code.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Message-Id: <240a97d522887a938faeb24a6a3e3a9ed24570b1.1700667908.git.pabeni@redhat.com>
  • Loading branch information
Paolo Abeni authored and matttbe committed Nov 23, 2023
1 parent e7294cd commit e29d5c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -3404,9 +3404,8 @@ static void mptcp_release_cb(struct sock *sk)
if (unlikely(msk->cb_flags)) {
/* be sure to sync the msk state before taking actions
* depending on sk_state (MPTCP_ERROR_REPORT)
* On sk release avoid actions depending on the first subflow
*/
if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first)
if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags))
__mptcp_sync_state(sk, msk->pending_state);
if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags))
__mptcp_error_report(sk);
Expand Down
5 changes: 2 additions & 3 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,6 @@ static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct soc

void __mptcp_sync_state(struct sock *sk, int state)
{
struct mptcp_sock *msk = mptcp_sk(sk);

__mptcp_propagate_sndbuf(sk, msk->first);
if (sk->sk_state == TCP_SYN_SENT) {
inet_sk_state_store(sk, state);
sk->sk_state_change(sk);
Expand All @@ -436,10 +433,12 @@ static void mptcp_propagate_state(struct sock *sk, struct sock *ssk)

mptcp_data_lock(sk);
if (!sock_owned_by_user(sk)) {
__mptcp_propagate_sndbuf(sk, msk->first);
__mptcp_sync_state(sk, ssk->sk_state);
} else {
msk->pending_state = ssk->sk_state;
__set_bit(MPTCP_SYNC_STATE, &msk->cb_flags);
__set_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags);
}
mptcp_data_unlock(sk);
}
Expand Down

0 comments on commit e29d5c1

Please sign in to comment.