Skip to content

Commit 991fb85

Browse files
committed
io_uring: move ctx->restricted check into io_check_restriction()
Just a cleanup, makes the code easier to read without too many dependent nested checks. Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 09bd844 commit 991fb85

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

io_uring/io_uring.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,8 @@ static inline bool io_check_restriction(struct io_ring_ctx *ctx,
20562056
struct io_kiocb *req,
20572057
unsigned int sqe_flags)
20582058
{
2059+
if (!ctx->restricted)
2060+
return true;
20592061
if (!test_bit(req->opcode, ctx->restrictions.sqe_op))
20602062
return false;
20612063

@@ -2158,7 +2160,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
21582160
}
21592161
}
21602162
if (unlikely(ctx->restricted || ctx->drain_active || ctx->drain_next)) {
2161-
if (ctx->restricted && !io_check_restriction(ctx, req, sqe_flags))
2163+
if (!io_check_restriction(ctx, req, sqe_flags))
21622164
return io_init_fail_req(req, -EACCES);
21632165
/* knock it to the slow queue path, will be drained there */
21642166
if (ctx->drain_active)

0 commit comments

Comments
 (0)