Re: IOSQE_IO_LINK vs. short send of SOCK_STREAM

Jens Axboe
2023-01-11T15:50:23Z

On 1/11/23 8:26 AM, Ming Lei wrote:
> Hello Guy,
>
> Per my understanding, a short send on SOCK_STREAM should terminate the
> remainder of the SQE chain built by IOSQE_IO_LINK.
>
> But from my observation, this point isn't true when using io_sendmsg or
> io_sendmsg_zc on TCP socket, and the other remainder of the chain still
> can be completed after one short send is found. MSG_WAITALL is off.
>
> For SOCK_STREAM, IOSQE_IO_LINK probably is the only way of io_uring for
> sending data correctly in batch. However, it depends on the assumption
> of chain termination by short send.

That is the intended behavior, maybe there are some cases where it's
not being set and req_set_fail() not being called? Do you have a test
case that I can try? If not, might be easier if you poke at
io_uring/net.c:io_sendmsg(). If we send less than what was asked for
and we don't retry, req_set_fail() should be called.

--
Jens Axboe