When a read returns less than requested, raw_sock_to_buf() considers
the socket buffer empty, and reports a shutdown if the poller already
saw one. But on a kTLS socket recvmsg() returns at most one record, so
the following records are never read when the peer's FIN is already
there. With "ktls on" on a server closing without a close_notify right
after its response, the response is lost and a 502 is returned.
Let's not do this for reads using a control message buffer, which are
only used for kTLS.
This was introduced in 3.3-dev7 by commit
3d685fcb7 ("MINOR: xprt: Add
recvmsg() and sendmsg() parameters to rcv_buf() and snd_buf()."). It
must be backported to 3.3.
if (ret > 0) {
b_add(buf, ret);
done += ret;
- if (ret < try) {
+ /* with kTLS a short read is only the end of a record */
+ if (ret < try && !msg_control) {
/* socket buffer exhausted */
fd_cant_recv(conn->handle.fd);