diff options
author | Pavel Begunkov | 2022-09-08 16:56:53 +0100 |
---|---|---|
committer | Jens Axboe | 2022-09-21 13:14:55 -0600 |
commit | 6567506b68b0cae3934f1a58b35d709f38fc2e90 (patch) | |
tree | 182940a046b826d267fbd759d6b8f5841405836f /io_uring/io_uring.h | |
parent | 76de6749d1bc1817367fedda94cd7c5d325df6c4 (diff) |
io_uring: disallow defer-tw run w/ no submitters
We try to restrict CQ waiters when IORING_SETUP_DEFER_TASKRUN is set,
but if nothing has been submitted yet it'll allow any waiter, which
violates the contract.
Fixes: c0e0d6ba25f1 ("io_uring: add IORING_SETUP_DEFER_TASKRUN")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Dylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/b4f0d3f14236d7059d08c5abe2661ef0b78b5528.1662652536.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.h')
-rw-r--r-- | io_uring/io_uring.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h index 4eea0836170e..d38173b9ac19 100644 --- a/io_uring/io_uring.h +++ b/io_uring/io_uring.h @@ -331,13 +331,8 @@ static inline struct io_kiocb *io_alloc_req(struct io_ring_ctx *ctx) static inline bool io_allowed_run_tw(struct io_ring_ctx *ctx) { - if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN)) - return true; - if (unlikely(ctx->submitter_task != current)) { - /* maybe this is before any submissions */ - return !ctx->submitter_task; - } - return true; + return likely(!(ctx->flags & IORING_SETUP_DEFER_TASKRUN) || + ctx->submitter_task == current); } #endif |