mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-04-13 09:59:31 +00:00
io_uring/cancel: wire up IORING_ASYNC_CANCEL_OP for sync cancel
Allow usage of IORING_ASYNC_CANCEL_OP through the sync cancelation API as well. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
d7b8b079a8
commit
f77569d22a
2 changed files with 11 additions and 4 deletions
|
@ -701,7 +701,9 @@ struct io_uring_sync_cancel_reg {
|
||||||
__s32 fd;
|
__s32 fd;
|
||||||
__u32 flags;
|
__u32 flags;
|
||||||
struct __kernel_timespec timeout;
|
struct __kernel_timespec timeout;
|
||||||
__u64 pad[4];
|
__u8 opcode;
|
||||||
|
__u8 pad[7];
|
||||||
|
__u64 pad2[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -265,17 +265,22 @@ int io_sync_cancel(struct io_ring_ctx *ctx, void __user *arg)
|
||||||
struct io_uring_sync_cancel_reg sc;
|
struct io_uring_sync_cancel_reg sc;
|
||||||
struct fd f = { };
|
struct fd f = { };
|
||||||
DEFINE_WAIT(wait);
|
DEFINE_WAIT(wait);
|
||||||
int ret;
|
int ret, i;
|
||||||
|
|
||||||
if (copy_from_user(&sc, arg, sizeof(sc)))
|
if (copy_from_user(&sc, arg, sizeof(sc)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
if (sc.flags & ~CANCEL_FLAGS)
|
if (sc.flags & ~CANCEL_FLAGS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (sc.pad[0] || sc.pad[1] || sc.pad[2] || sc.pad[3])
|
for (i = 0; i < ARRAY_SIZE(sc.pad); i++)
|
||||||
return -EINVAL;
|
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.data = sc.addr;
|
||||||
cd.flags = sc.flags;
|
cd.flags = sc.flags;
|
||||||
|
cd.opcode = sc.opcode;
|
||||||
|
|
||||||
/* we can grab a normal file descriptor upfront */
|
/* we can grab a normal file descriptor upfront */
|
||||||
if ((cd.flags & IORING_ASYNC_CANCEL_FD) &&
|
if ((cd.flags & IORING_ASYNC_CANCEL_FD) &&
|
||||||
|
|
Loading…
Add table
Reference in a new issue