diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 2602f1386160..0d20279024fb 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1295,6 +1295,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, int size_bias = 0; int avail_size; size_t ret = 0; + int mfrags; pr_debug("msk=%p ssk=%p sending dfrag at seq=%llu len=%u already sent=%u", msk, ssk, dfrag->data_seq, dfrag->data_len, info->sent); @@ -1302,6 +1303,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, /* compute send limit */ info->mss_now = tcp_send_mss(ssk, &info->size_goal, info->flags); avail_size = info->size_goal; + mfrags = READ_ONCE(sysctl_max_skb_frags); skb = tcp_write_queue_tail(ssk); if (skb) { /* Limit the write to the size available in the @@ -1317,7 +1319,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, } must_collapse = (info->size_goal - skb->len > 0) && - (skb_shinfo(skb)->nr_frags < sysctl_max_skb_frags); + (skb_shinfo(skb)->nr_frags < mfrags); if (must_collapse) { size_bias = skb->len; avail_size = info->size_goal - skb->len; @@ -1325,7 +1327,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, } alloc_skb: - if (!must_collapse && !ssk->sk_tx_skb_cache && + if (!must_collapse && !mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held)) return 0; @@ -1363,6 +1365,11 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, } mpext = skb_ext_find(tail, SKB_EXT_MPTCP); + if (!mpext) + pr_warn("must_collapse=%d old skb=%p avail_size=%d zero_window_probe=%d ws=%d state=%d frags=%d:%d", + must_collapse, skb, avail_size, zero_window_probe, + mptcp_subflow_ctx(ssk)->rel_write_seq, + ssk->sk_state, mfrags, READ_ONCE(sysctl_max_skb_frags)); if (WARN_ON_ONCE(!mpext)) { /* should never reach here, stream corrupted */ return -EINVAL;