]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Don't prematurely return short completions on blocking sockets.
authorjhb <jhb@FreeBSD.org>
Tue, 24 May 2016 03:13:27 +0000 (03:13 +0000)
committerjhb <jhb@FreeBSD.org>
Tue, 24 May 2016 03:13:27 +0000 (03:13 +0000)
commit2889382edd9ff570425d6f8614b99266ee6caba3
tree76800b7d78dc4fdd404d966036745687136822be
parented08ad3868edcdc18f2e30c4e52c0bf45a34c4c6
Don't prematurely return short completions on blocking sockets.

Always requeue an AIO job at the head of the socket buffer's queue if
sosend() or soreceive() returns EWOULDBLOCK on a blocking socket.
Previously, requests were only requeued if they returned EWOULDBLOCK
and completed no data.  Now after a partial completion on a blocking
socket the request is queued and the remaining request is retried when
the socket is ready.  This allows writes larger than the currently
available space on a blocking socket to fully complete.  Reads on a
blocking socket that satifsy the low watermark can still return a short
read (same as read()).

In order to track previously completed data, the internal 'status'
field of the AIO job is used to store the amount of previously
computed data.

Non-blocking sockets continue to return short completions for both
reads and writes.

Add a test for a "large" AIO write on a blocking socket that writes
twice the socket buffer size to a UNIX domain socket.

Sponsored by: Chelsio Communications
sys/kern/sys_socket.c
tests/sys/aio/aio_test.c