• Florian Westphal's avatar
    mptcp: avoid blocking in tcp_sendpages · 72511aab
    Florian Westphal authored
    The transmit loop continues to xmit new data until an error is returned
    or all data was transmitted.
    
    For the blocking i/o case, this means that tcp_sendpages() may block on
    the subflow until more space becomes available, i.e. we end up sleeping
    with the mptcp socket lock held.
    
    Instead we should check if a different subflow is ready to be used.
    
    This restarts the subflow sk lookup when the tx operation succeeded
    and the tcp subflow can't accept more data or if tcp_sendpages
    indicates -EAGAIN on a blocking mptcp socket.
    
    In that case we also need to set the NOSPACE bit to make sure we get
    notified once memory becomes available.
    
    In case all subflows are busy, the existing logic will wait until a
    subflow is ready, releasing the mptcp socket lock while doing so.
    
    The mptcp worker already sets DONTWAIT, so no need to make changes there.
    
    v2:
     * set NOSPACE bit
     * add a comment to clarify that mptcp-sk sndbuf limits need to
       be checked as well.
    Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    72511aab
protocol.c 49.7 KB