[PATCH 2/2] io_uring/cancel: complete single futex or waitid cancel with 0
From: agxr
Date: Sat Oct 24 2026 - 12:36:52 EST
A cancel of one request completes with 0, as io_uring_prep_cancel(3)
documents and as poll, io-wq and timeouts do. For a futex wait or a
waitid it completes with 1. io_futex_cancel() and io_waitid_cancel()
return the number canceled, and __io_async_cancel() hands it on, for
IORING_OP_ASYNC_CANCEL and IORING_REGISTER_SYNC_CANCEL alike.
Turn that count into 0, as io_req_task_link_timeout() does since commit
c74193430feb ("io_uring/timeout: don't end a linked timeout with 1").
liburing's futex and waitid tests expect the 1, and a liburing change
makes them accept 0 as well.
Fixes: 194bb58c6090 ("io_uring: add support for futex wake and wait")
Fixes: f31ecf671ddc ("io_uring: add IORING_OP_WAITID support")
Signed-off-by: agxr <agxr@xxxxxxxxxxx>
---
io_uring/cancel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/io_uring/cancel.c b/io_uring/cancel.c
index e4b27b79b05c..20df4e3538f3 100644
--- a/io_uring/cancel.c
+++ b/io_uring/cancel.c
@@ -197,7 +197,7 @@ static int __io_async_cancel(struct io_cancel_data *cd,
if (ret == -ENOENT)
break;
if (!all)
- return ret;
+ return ret > 0 ? 0 : ret;
nr += ret > 0 ? ret : 1;
} while (1);
--
2.56.0