Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+39 -22
+29 -13
fs/io_uring.c
··· 783 783 task_work_func_t func; 784 784 }; 785 785 786 + enum { 787 + IORING_RSRC_FILE = 0, 788 + IORING_RSRC_BUFFER = 1, 789 + }; 790 + 786 791 /* 787 792 * NOTE! Each of the iocb union members has the file pointer 788 793 * as the first entry in their struct definition. So you can ··· 9676 9671 IORING_FEAT_SUBMIT_STABLE | IORING_FEAT_RW_CUR_POS | 9677 9672 IORING_FEAT_CUR_PERSONALITY | IORING_FEAT_FAST_POLL | 9678 9673 IORING_FEAT_POLL_32BITS | IORING_FEAT_SQPOLL_NONFIXED | 9679 - IORING_FEAT_EXT_ARG | IORING_FEAT_NATIVE_WORKERS; 9674 + IORING_FEAT_EXT_ARG | IORING_FEAT_NATIVE_WORKERS | 9675 + IORING_FEAT_RSRC_TAGS; 9680 9676 9681 9677 if (copy_to_user(params, p, sizeof(*p))) { 9682 9678 ret = -EFAULT; ··· 9917 9911 } 9918 9912 9919 9913 static int io_register_rsrc_update(struct io_ring_ctx *ctx, void __user *arg, 9920 - unsigned size) 9914 + unsigned size, unsigned type) 9921 9915 { 9922 9916 struct io_uring_rsrc_update2 up; 9923 9917 ··· 9925 9919 return -EINVAL; 9926 9920 if (copy_from_user(&up, arg, sizeof(up))) 9927 9921 return -EFAULT; 9928 - if (!up.nr) 9922 + if (!up.nr || up.resv) 9929 9923 return -EINVAL; 9930 - return __io_register_rsrc_update(ctx, up.type, &up, up.nr); 9924 + return __io_register_rsrc_update(ctx, type, &up, up.nr); 9931 9925 } 9932 9926 9933 9927 static int io_register_rsrc(struct io_ring_ctx *ctx, void __user *arg, 9934 - unsigned int size) 9928 + unsigned int size, unsigned int type) 9935 9929 { 9936 9930 struct io_uring_rsrc_register rr; 9937 9931 ··· 9942 9936 memset(&rr, 0, sizeof(rr)); 9943 9937 if (copy_from_user(&rr, arg, size)) 9944 9938 return -EFAULT; 9945 - if (!rr.nr) 9939 + if (!rr.nr || rr.resv || rr.resv2) 9946 9940 return -EINVAL; 9947 9941 9948 - switch (rr.type) { 9942 + switch (type) { 9949 9943 case IORING_RSRC_FILE: 9950 9944 return io_sqe_files_register(ctx, u64_to_user_ptr(rr.data), 9951 9945 rr.nr, u64_to_user_ptr(rr.tags)); ··· 9967 9961 case IORING_REGISTER_PROBE: 9968 9962 case IORING_REGISTER_PERSONALITY: 9969 9963 case IORING_UNREGISTER_PERSONALITY: 9970 - case IORING_REGISTER_RSRC: 9971 - case IORING_REGISTER_RSRC_UPDATE: 9964 + case IORING_REGISTER_FILES2: 9965 + case IORING_REGISTER_FILES_UPDATE2: 9966 + case IORING_REGISTER_BUFFERS2: 9967 + case IORING_REGISTER_BUFFERS_UPDATE: 9972 9968 return false; 9973 9969 default: 9974 9970 return true; ··· 10096 10088 case IORING_REGISTER_RESTRICTIONS: 10097 10089 ret = io_register_restrictions(ctx, arg, nr_args); 10098 10090 break; 10099 - case IORING_REGISTER_RSRC: 10100 - ret = io_register_rsrc(ctx, arg, nr_args); 10091 + case IORING_REGISTER_FILES2: 10092 + ret = io_register_rsrc(ctx, arg, nr_args, IORING_RSRC_FILE); 10101 10093 break; 10102 - case IORING_REGISTER_RSRC_UPDATE: 10103 - ret = io_register_rsrc_update(ctx, arg, nr_args); 10094 + case IORING_REGISTER_FILES_UPDATE2: 10095 + ret = io_register_rsrc_update(ctx, arg, nr_args, 10096 + IORING_RSRC_FILE); 10097 + break; 10098 + case IORING_REGISTER_BUFFERS2: 10099 + ret = io_register_rsrc(ctx, arg, nr_args, IORING_RSRC_BUFFER); 10100 + break; 10101 + case IORING_REGISTER_BUFFERS_UPDATE: 10102 + ret = io_register_rsrc_update(ctx, arg, nr_args, 10103 + IORING_RSRC_BUFFER); 10104 10104 break; 10105 10105 default: 10106 10106 ret = -EINVAL;
+10 -9
include/uapi/linux/io_uring.h
··· 280 280 #define IORING_FEAT_SQPOLL_NONFIXED (1U << 7) 281 281 #define IORING_FEAT_EXT_ARG (1U << 8) 282 282 #define IORING_FEAT_NATIVE_WORKERS (1U << 9) 283 + #define IORING_FEAT_RSRC_TAGS (1U << 10) 283 284 284 285 /* 285 286 * io_uring_register(2) opcodes and arguments ··· 299 298 IORING_UNREGISTER_PERSONALITY = 10, 300 299 IORING_REGISTER_RESTRICTIONS = 11, 301 300 IORING_REGISTER_ENABLE_RINGS = 12, 302 - IORING_REGISTER_RSRC = 13, 303 - IORING_REGISTER_RSRC_UPDATE = 14, 301 + 302 + /* extended with tagging */ 303 + IORING_REGISTER_FILES2 = 13, 304 + IORING_REGISTER_FILES_UPDATE2 = 14, 305 + IORING_REGISTER_BUFFERS2 = 15, 306 + IORING_REGISTER_BUFFERS_UPDATE = 16, 304 307 305 308 /* this goes last */ 306 309 IORING_REGISTER_LAST ··· 317 312 __aligned_u64 /* __s32 * */ fds; 318 313 }; 319 314 320 - enum { 321 - IORING_RSRC_FILE = 0, 322 - IORING_RSRC_BUFFER = 1, 323 - }; 324 - 325 315 struct io_uring_rsrc_register { 326 - __u32 type; 327 316 __u32 nr; 317 + __u32 resv; 318 + __u64 resv2; 328 319 __aligned_u64 data; 329 320 __aligned_u64 tags; 330 321 }; ··· 336 335 __u32 resv; 337 336 __aligned_u64 data; 338 337 __aligned_u64 tags; 339 - __u32 type; 340 338 __u32 nr; 339 + __u32 resv2; 341 340 }; 342 341 343 342 /* Skip updating fd indexes set to this value in the fd table */