From: agxr <agxr@disroot.org>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Cc: agxr <agxr@disroot.org>,
linux-kernel@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>
Subject: [PATCH 2/2] io_uring/cancel: complete single futex or waitid cancel with 0
Date: Sat, 24 Oct 2026 21:31:25 +0500 [thread overview]
Message-ID: <20261024163259.19372-3-agxr@disroot.org> (raw)
In-Reply-To: <20261024163259.19372-1-agxr@disroot.org>
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@disroot.org>
---
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
next prev parent reply other threads:[~2026-10-24 16:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 16:31 [PATCH 0/2] io_uring/cancel: futex and waitid cancel results agxr
2026-10-24 16:31 ` [PATCH 1/2] io_uring/cancel: count all canceled futex and waitid requests on CANCEL_ALL agxr
2026-10-24 16:31 ` agxr [this message]
2026-10-25 3:23 ` [PATCH 0/2] io_uring/cancel: futex and waitid cancel results Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261024163259.19372-3-agxr@disroot.org \
--to=agxr@disroot.org \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®