mptcp: fix pending data accounting

When sendmsg() needs to wait for memory, the pending data
is not updated. That causes a drift in forward memory allocation,
leading to stall and/or warnings at socket close time.

This change addresses the above issue moving the pending data
counter update inside the sendmsg() main loop.

Fixes: 6e628cd3a8 ("mptcp: use mptcp release_cb for delayed tasks")
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Paolo Abeni 2020-12-16 12:48:35 +01:00 коммит произвёл Jakub Kicinski
Родитель 219d04992b
Коммит 13e1603739
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -1658,6 +1658,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
frag_truesize += psize;
pfrag->offset += frag_truesize;
WRITE_ONCE(msk->write_seq, msk->write_seq + psize);
msk->tx_pending_data += psize;
/* charge data on mptcp pending queue to the msk socket
* Note: we charge such data both to sk and ssk
@ -1683,10 +1684,8 @@ wait_for_memory:
goto out;
}
if (copied) {
msk->tx_pending_data += copied;
if (copied)
mptcp_push_pending(sk, msg->msg_flags);
}
out:
release_sock(sk);