client: Send the rest of a short io_uring send instead of disconnecting #174

Open
koolkhel wants to merge 2 commits from koolkhel/vitastor:zc-short-send into master

2 Commits

Author SHA1 Message Date
17793798f4 client: Drop the log line for a short io_uring send, it is a normal case now 2026-11-25 22:48:28 +03:00
2a27c0bbe4 client: Send the rest of a short io_uring send instead of disconnecting
A sendmsg with MSG_WAITALL submitted through io_uring can still complete
short: after many poll retries io_uring punts it to io-wq, where it runs
with MSG_DONTWAIT. handle_send() took that for a socket error and
disconnected a healthy peer. A first CQE with -EAGAIN or -EINTR kept
send_list, but only a later queued op resent it, and the failed send's
send_free range was never handed to the retry: after a copy send its
entries stayed referenced until disconnect, holding every later reply,
and after a zero-copy send its notification freed replies that
send_list still pointed into.

Handle both as a short send: eat the sent prefix, keep the rest in
send_list and schedule the client through write_ready_clients, so the
next try_send() sends the rest, without any EPOLLOUT switching. The
IN/BUF entries of the short send move to the end of send_free and the
next send's range starts at them, while the short send keeps REF-only
entries in its own range. send_free is freed from the front, so a
buffer is freed only when both sends are done and, if zero-copy,
released.

Add send path tests over a fake ring, so they run without io_uring.
2026-11-24 12:52:21 +03:00