[PATCH 0/2] io_uring: fix short read links and align link timeout cancel
Yang Xiuwei <[email protected]>
| Newsgroups | org.kernel.vger.io-uring |
|---|---|
| Message-ID | <[email protected]> |
This series addresses two independent issues affecting linked requests
behind a link timeout, found while exercising read -> link timeout ->
nop chains on pipes.
1) Short non-regular file read completion (patch 1, bug fix)
__io_read() treats a short read on non-regular files as success and
returns without filling the iov. __io_complete_rw_common() still
treated ret != cqe.res as failure and set REQ_F_FAIL. The head request
could therefore post a successful CQE while internally failing the link
chain, incorrectly canceling subsequent linked requests.
2) Pending link timeout cancel (patch 2, behavior alignment)
TIMEOUT_REMOVE and IORING_OP_ASYNC_CANCEL use io_timeout_cancel(), which
only scanned timeout_list. Pending link timeouts live on ltimeout_list
instead, so cancel/remove by user_data returned -ENOENT even though the
timeout was still armed.
IORING_OP_TIMEOUT_REMOVE with IORING_LINK_TIMEOUT_UPDATE already handles
link timeouts through a separate path. Extend io_timeout_cancel() to
fall back to ltimeout_list and reuse __io_disarm_linked_timeout(), so
plain remove/cancel behaves consistently.
The two patches are independent and may be applied separately, though
both are needed for full link-timeout chain test coverage.
Patch summary
-------------
1/2 io_uring/rw: fix link failure on successful pipe short reads
2/2 io_uring/timeout: cancel pending link timeouts from ltimeout_list
Test plan
---------
Matching liburing tests are submitted separately. With both kernel
patches applied:
$ make -C test link-timeout.t
$ ./test/link-timeout.t
Expected highlights:
- test_link_timeout_natural_disarm_chain: read=1, lt=-ECANCELED, nop=0
- test_link_timeout_remove_chain: remove=0, lt=-ECANCELED, read=1,
nop=0
io_uring/rw: fix link failure on successful pipe short reads
io_uring/timeout: cancel pending link timeouts from ltimeout_list
--
2.25.1
Signed-off-by: Yang Xiuwei <[email protected]>