From: Jens Axboe <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>
Subject: [PATCH 8/8] io_uring/cancel: wire up IORING_ASYNC_CANCEL_OP for sync cancel
Date: Fri, 23 Jun 2023 10:48:04 -0600 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
Allow usage of IORING_ASYNC_CANCEL_OP through the sync cancelation
API as well.
Signed-off-by: Jens Axboe <[email protected]>
---
include/uapi/linux/io_uring.h | 4 +++-
io_uring/cancel.c | 11 ++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index af3b862fa905..7fbd57f4c2ff 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -699,7 +699,9 @@ struct io_uring_sync_cancel_reg {
__s32 fd;
__u32 flags;
struct __kernel_timespec timeout;
- __u64 pad[4];
+ __u8 opcode;
+ __u8 pad[7];
+ __u64 pad2[3];
};
/*
diff --git a/io_uring/cancel.c b/io_uring/cancel.c
index d91116b032eb..7b23607cf4af 100644
--- a/io_uring/cancel.c
+++ b/io_uring/cancel.c
@@ -265,17 +265,22 @@ int io_sync_cancel(struct io_ring_ctx *ctx, void __user *arg)
struct io_uring_sync_cancel_reg sc;
struct fd f = { };
DEFINE_WAIT(wait);
- int ret;
+ int ret, i;
if (copy_from_user(&sc, arg, sizeof(sc)))
return -EFAULT;
if (sc.flags & ~CANCEL_FLAGS)
return -EINVAL;
- if (sc.pad[0] || sc.pad[1] || sc.pad[2] || sc.pad[3])
- return -EINVAL;
+ for (i = 0; i < ARRAY_SIZE(sc.pad); i++)
+ if (sc.pad[i])
+ return -EINVAL;
+ for (i = 0; i < ARRAY_SIZE(sc.pad2); i++)
+ if (sc.pad2[i])
+ return -EINVAL;
cd.data = sc.addr;
cd.flags = sc.flags;
+ cd.opcode = sc.opcode;
/* we can grab a normal file descriptor upfront */
if ((cd.flags & IORING_ASYNC_CANCEL_FD) &&
--
2.40.1
prev parent reply other threads:[~2023-06-23 16:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 16:47 [PATCHSET 0/8] Add support for IORING_ASYNC_CANCEL_OP Jens Axboe
2023-06-23 16:47 ` [PATCH 1/8] io_uring/poll: always set 'ctx' in io_cancel_data Jens Axboe
2023-06-23 16:47 ` [PATCH 2/8] io_uring/timeout: " Jens Axboe
2023-06-23 16:47 ` [PATCH 3/8] io_uring/cancel: abstract out request match helper Jens Axboe
2023-06-23 16:48 ` [PATCH 4/8] io_uring/cancel: fix sequence matching for IORING_ASYNC_CANCEL_ANY Jens Axboe
2023-06-23 16:48 ` [PATCH 5/8] io_uring: use cancelation match helper for poll and timeout requests Jens Axboe
2023-06-23 16:48 ` [PATCH 6/8] io_uring/cancel: add IORING_ASYNC_CANCEL_USERDATA Jens Axboe
2023-06-23 16:48 ` [PATCH 7/8] io_uring/cancel: support opcode based lookup and cancelation Jens Axboe
2023-06-23 16:48 ` Jens Axboe [this message]
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 \
[email protected] \
[email protected] \
[email protected] \
/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