mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 16:53:58 -05:00
io_uring-5.13-2021-06-12
-----BEGIN PGP SIGNATURE----- iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmDEwEEQHGF4Ym9lQGtl cm5lbC5kawAKCRD301j7KXHgpu2uEACIZXc0e4Jz2tJmtlLzhm0T+YUXu88/n0Ki 3HsCfjyk0k2tvGjAmzLgBruR+0dxuoTlC8ZyLWkCgYFvRxCQMrjxB4+Q53WAAPud ictv/5C992eWfmkk5lKWYh/SVUZU0nN/HlcITggFzH+/Ek4RgqBJK6rYPpN4YM6W OifSZ22xwjZy9i8svzCPzGUbS5d5qbNeRSaacfADWFmzTqqzllWz/KkN633UFefR tkqWy610P0O8fz3xe5HcECIOc3aNRZuk5zrNqCJPvxcOdYlqlL/HfsWMACEiC/g1 N3ahNGrUzJqhB1QNAIKATKAlh8hzAws9t/alLJQzSHZWRu7vso0qctoVJT3i6xRp qD17EAQgrC0R0fQxdHmoMzRHEnKPCXQx36wb/mhZbG60/Q+scmSrFXp86XvbKZiI uzHTsUL/80bRXHuVrKXT+JWTRCzpv1yk9ufIVzSOheVCl/H6bxZ29cabBL2/XvvI d+OljDsy7oMH6rOBFi3XYmwZShEoUqeATeFoFf5isjkWfe7qdiMVu4apD8fBhIjX 8rNLjp0nIKN+5IjHwFkAXRwp8P1SJQ8c7Tl4I6xY82FsMQxUUgMhjSqrn58i2g9d Lem9YHKaXIbw1yfWcaf8erA6d0S4rujG+j3miG0y248kOTb9FeMbfbRgjj8v99m1 XB7F9SIQUw== =MbrN -----END PGP SIGNATURE----- Merge tag 'io_uring-5.13-2021-06-12' of git://git.kernel.dk/linux-block Pull io_uring fixes from Jens Axboe: "Just an API change for the registration changes that went into this release. Better to get it sorted out now than before it's too late" * tag 'io_uring-5.13-2021-06-12' of git://git.kernel.dk/linux-block: io_uring: add feature flag for rsrc tags io_uring: change registration/upd/rsrc tagging ABI
This commit is contained in:
commit
b2568eeb96
2 changed files with 39 additions and 22 deletions
|
@ -783,6 +783,11 @@ struct io_task_work {
|
|||
task_work_func_t func;
|
||||
};
|
||||
|
||||
enum {
|
||||
IORING_RSRC_FILE = 0,
|
||||
IORING_RSRC_BUFFER = 1,
|
||||
};
|
||||
|
||||
/*
|
||||
* NOTE! Each of the iocb union members has the file pointer
|
||||
* as the first entry in their struct definition. So you can
|
||||
|
@ -9671,7 +9676,8 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p,
|
|||
IORING_FEAT_SUBMIT_STABLE | IORING_FEAT_RW_CUR_POS |
|
||||
IORING_FEAT_CUR_PERSONALITY | IORING_FEAT_FAST_POLL |
|
||||
IORING_FEAT_POLL_32BITS | IORING_FEAT_SQPOLL_NONFIXED |
|
||||
IORING_FEAT_EXT_ARG | IORING_FEAT_NATIVE_WORKERS;
|
||||
IORING_FEAT_EXT_ARG | IORING_FEAT_NATIVE_WORKERS |
|
||||
IORING_FEAT_RSRC_TAGS;
|
||||
|
||||
if (copy_to_user(params, p, sizeof(*p))) {
|
||||
ret = -EFAULT;
|
||||
|
@ -9911,7 +9917,7 @@ static int io_register_files_update(struct io_ring_ctx *ctx, void __user *arg,
|
|||
}
|
||||
|
||||
static int io_register_rsrc_update(struct io_ring_ctx *ctx, void __user *arg,
|
||||
unsigned size)
|
||||
unsigned size, unsigned type)
|
||||
{
|
||||
struct io_uring_rsrc_update2 up;
|
||||
|
||||
|
@ -9919,13 +9925,13 @@ static int io_register_rsrc_update(struct io_ring_ctx *ctx, void __user *arg,
|
|||
return -EINVAL;
|
||||
if (copy_from_user(&up, arg, sizeof(up)))
|
||||
return -EFAULT;
|
||||
if (!up.nr)
|
||||
if (!up.nr || up.resv)
|
||||
return -EINVAL;
|
||||
return __io_register_rsrc_update(ctx, up.type, &up, up.nr);
|
||||
return __io_register_rsrc_update(ctx, type, &up, up.nr);
|
||||
}
|
||||
|
||||
static int io_register_rsrc(struct io_ring_ctx *ctx, void __user *arg,
|
||||
unsigned int size)
|
||||
unsigned int size, unsigned int type)
|
||||
{
|
||||
struct io_uring_rsrc_register rr;
|
||||
|
||||
|
@ -9936,10 +9942,10 @@ static int io_register_rsrc(struct io_ring_ctx *ctx, void __user *arg,
|
|||
memset(&rr, 0, sizeof(rr));
|
||||
if (copy_from_user(&rr, arg, size))
|
||||
return -EFAULT;
|
||||
if (!rr.nr)
|
||||
if (!rr.nr || rr.resv || rr.resv2)
|
||||
return -EINVAL;
|
||||
|
||||
switch (rr.type) {
|
||||
switch (type) {
|
||||
case IORING_RSRC_FILE:
|
||||
return io_sqe_files_register(ctx, u64_to_user_ptr(rr.data),
|
||||
rr.nr, u64_to_user_ptr(rr.tags));
|
||||
|
@ -9961,8 +9967,10 @@ static bool io_register_op_must_quiesce(int op)
|
|||
case IORING_REGISTER_PROBE:
|
||||
case IORING_REGISTER_PERSONALITY:
|
||||
case IORING_UNREGISTER_PERSONALITY:
|
||||
case IORING_REGISTER_RSRC:
|
||||
case IORING_REGISTER_RSRC_UPDATE:
|
||||
case IORING_REGISTER_FILES2:
|
||||
case IORING_REGISTER_FILES_UPDATE2:
|
||||
case IORING_REGISTER_BUFFERS2:
|
||||
case IORING_REGISTER_BUFFERS_UPDATE:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
|
@ -10088,11 +10096,19 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
|
|||
case IORING_REGISTER_RESTRICTIONS:
|
||||
ret = io_register_restrictions(ctx, arg, nr_args);
|
||||
break;
|
||||
case IORING_REGISTER_RSRC:
|
||||
ret = io_register_rsrc(ctx, arg, nr_args);
|
||||
case IORING_REGISTER_FILES2:
|
||||
ret = io_register_rsrc(ctx, arg, nr_args, IORING_RSRC_FILE);
|
||||
break;
|
||||
case IORING_REGISTER_RSRC_UPDATE:
|
||||
ret = io_register_rsrc_update(ctx, arg, nr_args);
|
||||
case IORING_REGISTER_FILES_UPDATE2:
|
||||
ret = io_register_rsrc_update(ctx, arg, nr_args,
|
||||
IORING_RSRC_FILE);
|
||||
break;
|
||||
case IORING_REGISTER_BUFFERS2:
|
||||
ret = io_register_rsrc(ctx, arg, nr_args, IORING_RSRC_BUFFER);
|
||||
break;
|
||||
case IORING_REGISTER_BUFFERS_UPDATE:
|
||||
ret = io_register_rsrc_update(ctx, arg, nr_args,
|
||||
IORING_RSRC_BUFFER);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
|
|
|
@ -280,6 +280,7 @@ struct io_uring_params {
|
|||
#define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
|
||||
#define IORING_FEAT_EXT_ARG (1U << 8)
|
||||
#define IORING_FEAT_NATIVE_WORKERS (1U << 9)
|
||||
#define IORING_FEAT_RSRC_TAGS (1U << 10)
|
||||
|
||||
/*
|
||||
* io_uring_register(2) opcodes and arguments
|
||||
|
@ -298,8 +299,12 @@ enum {
|
|||
IORING_UNREGISTER_PERSONALITY = 10,
|
||||
IORING_REGISTER_RESTRICTIONS = 11,
|
||||
IORING_REGISTER_ENABLE_RINGS = 12,
|
||||
IORING_REGISTER_RSRC = 13,
|
||||
IORING_REGISTER_RSRC_UPDATE = 14,
|
||||
|
||||
/* extended with tagging */
|
||||
IORING_REGISTER_FILES2 = 13,
|
||||
IORING_REGISTER_FILES_UPDATE2 = 14,
|
||||
IORING_REGISTER_BUFFERS2 = 15,
|
||||
IORING_REGISTER_BUFFERS_UPDATE = 16,
|
||||
|
||||
/* this goes last */
|
||||
IORING_REGISTER_LAST
|
||||
|
@ -312,14 +317,10 @@ struct io_uring_files_update {
|
|||
__aligned_u64 /* __s32 * */ fds;
|
||||
};
|
||||
|
||||
enum {
|
||||
IORING_RSRC_FILE = 0,
|
||||
IORING_RSRC_BUFFER = 1,
|
||||
};
|
||||
|
||||
struct io_uring_rsrc_register {
|
||||
__u32 type;
|
||||
__u32 nr;
|
||||
__u32 resv;
|
||||
__u64 resv2;
|
||||
__aligned_u64 data;
|
||||
__aligned_u64 tags;
|
||||
};
|
||||
|
@ -335,8 +336,8 @@ struct io_uring_rsrc_update2 {
|
|||
__u32 resv;
|
||||
__aligned_u64 data;
|
||||
__aligned_u64 tags;
|
||||
__u32 type;
|
||||
__u32 nr;
|
||||
__u32 resv2;
|
||||
};
|
||||
|
||||
/* Skip updating fd indexes set to this value in the fd table */
|
||||
|
|
Loading…
Add table
Reference in a new issue