]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
io_uring/uring_cmd: explicitly disallow cancelations for IOPOLL
authorJens Axboe <axboe@kernel.dk>
Wed, 14 Jan 2026 15:51:02 +0000 (08:51 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 15 Jan 2026 05:04:11 +0000 (22:04 -0700)
This currently isn't supported, and due to a recent commit, it also
cannot easily be supported by io_uring due to hash_node and IOPOLL
completion data overlapping.

This can be revisited if we ever do support cancelations of requests
that have gone to the block stack.

Suggested-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/uring_cmd.c

index 197474911f0463d471ed4e4ceedbe5d2992f65d5..ee7b49f47cb552aad95f74c3a53e8cad467a433b 100644 (file)
@@ -104,6 +104,15 @@ void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
        struct io_kiocb *req = cmd_to_io_kiocb(cmd);
        struct io_ring_ctx *ctx = req->ctx;
 
+       /*
+        * Doing cancelations on IOPOLL requests are not supported. Both
+        * because they can't get canceled in the block stack, but also
+        * because iopoll completion data overlaps with the hash_node used
+        * for tracking.
+        */
+       if (ctx->flags & IORING_SETUP_IOPOLL)
+               return;
+
        if (!(cmd->flags & IORING_URING_CMD_CANCELABLE)) {
                cmd->flags |= IORING_URING_CMD_CANCELABLE;
                io_ring_submit_lock(ctx, issue_flags);