Skip to content

Commit bdd70eb

Browse files
Paolo Abenidavem330
Paolo Abeni
authored andcommitted
mptcp: drop the push_pending field
Such field is there to avoid acquiring the data lock in a few spots, but it adds complexity to the already non trivial locking schema. All the relevant call sites (mptcp-level re-injection, set socket options), are slow-path, drop such field in favor of 'cb_flags', adding the relevant locking. This patch could be seen as an improvement, instead of a fix. But it simplifies the next patch. The 'Fixes' tag has been added to help having this series backported to stable. Fixes: e9d09ba ("mptcp: avoid atomic bit manipulation when possible") Cc: [email protected] Signed-off-by: Paolo Abeni <[email protected]> Reviewed-by: Mat Martineau <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bab091d commit bdd70eb

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

net/mptcp/protocol.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -1505,8 +1505,11 @@ static void mptcp_update_post_push(struct mptcp_sock *msk,
15051505

15061506
void mptcp_check_and_set_pending(struct sock *sk)
15071507
{
1508-
if (mptcp_send_head(sk))
1509-
mptcp_sk(sk)->push_pending |= BIT(MPTCP_PUSH_PENDING);
1508+
if (mptcp_send_head(sk)) {
1509+
mptcp_data_lock(sk);
1510+
mptcp_sk(sk)->cb_flags |= BIT(MPTCP_PUSH_PENDING);
1511+
mptcp_data_unlock(sk);
1512+
}
15101513
}
15111514

15121515
static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
@@ -3142,7 +3145,6 @@ static int mptcp_disconnect(struct sock *sk, int flags)
31423145
mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE);
31433146
WRITE_ONCE(msk->flags, 0);
31443147
msk->cb_flags = 0;
3145-
msk->push_pending = 0;
31463148
msk->recovery = false;
31473149
msk->can_ack = false;
31483150
msk->fully_established = false;
@@ -3330,8 +3332,7 @@ static void mptcp_release_cb(struct sock *sk)
33303332
struct mptcp_sock *msk = mptcp_sk(sk);
33313333

33323334
for (;;) {
3333-
unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED) |
3334-
msk->push_pending;
3335+
unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED);
33353336
struct list_head join_list;
33363337

33373338
if (!flags)
@@ -3347,7 +3348,6 @@ static void mptcp_release_cb(struct sock *sk)
33473348
* datapath acquires the msk socket spinlock while helding
33483349
* the subflow socket lock
33493350
*/
3350-
msk->push_pending = 0;
33513351
msk->cb_flags &= ~flags;
33523352
spin_unlock_bh(&sk->sk_lock.slock);
33533353

net/mptcp/protocol.h

-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ struct mptcp_sock {
286286
int rmem_released;
287287
unsigned long flags;
288288
unsigned long cb_flags;
289-
unsigned long push_pending;
290289
bool recovery; /* closing subflow write queue reinjected */
291290
bool can_ack;
292291
bool fully_established;

0 commit comments

Comments
 (0)