sockets: in sousrsend() pass down the error to aio(4)

This somewhat undermines the initial goal of sousrsend() to have all
the special error handling for a write on a socket in a single place.
The aio(4) needs to see EWOULDBLOCK to re-schedule the job.  Because
aio(4) handles return from soreceive() and sousrsend() with the same
code, we can't check for (error == 0 && done < job_nbytes).  Keeping
this exclusion for aio(4) seems a lesser evil.

Fixes:	7a2c93b86e
This commit is contained in:
Gleb Smirnoff 2023-02-01 13:03:10 -08:00
parent 575e48f1c4
commit a0102dee34

View File

@ -1861,8 +1861,15 @@ sousrsend(struct socket *so, struct sockaddr *addr, struct uio *uio,
td);
CURVNET_RESTORE();
if (error != 0) {
/*
* Clear transient errors for stream protocols if they made
* some progress. Make exclusion for aio(4) that would
* schedule a new write in case of EWOULDBLOCK and clear
* error itself. See soaio_process_job().
*/
if (uio->uio_resid != len &&
(so->so_proto->pr_flags & PR_ATOMIC) == 0 &&
userproc == NULL &&
(error == ERESTART || error == EINTR ||
error == EWOULDBLOCK))
error = 0;