Skip to contentSkip to conversation

io_uring/uring_cmd: explicitly disallow cancelations for IOPOLL

PATCH In review Jens Axboe 2 participants 2 messages Jan 14 – Jan 15 io_uring

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io_uring/uring_cmd: explicitly disallow cancelations for IOPOLL

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.

---

io_uring/uring_cmd.c +9 -0
index 197474911f04..ee7b49f47cb5 100644
@@ -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);
Signature · 1 line
Jens Axboe
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Jens Axboe

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.

---

io_uring/uring_cmd.c +0 -0
index 197474911f04..ee7b49f47cb5 100644
@@ -104,6 +104,15 @@ void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
 	struct io_kiocb *req = cmd_to_io_kiocb(cmd);

io_uring/uring_cmd.c void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd, · line 114

Quoted 10 lines
io_uring/uring_cmd.c +8 -0
 	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;

Maybe better to add warn_on_once(), but not a big deal, anyway:

Thanks,
Ming