mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
io_uring: enable file table usage for SQPOLL rings
Now that SQPOLL supports non-registered files and grabs the file table, we can relax the restriction on open/close/accept/connect and allow them on a ring that is setup with IORING_SETUP_SQPOLL. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
28cea78af4
commit
14587a4664
@ -869,7 +869,7 @@ static const struct io_op_def io_op_defs[] = {
|
||||
},
|
||||
[IORING_OP_OPENAT] = {
|
||||
.work_flags = IO_WQ_WORK_FILES | IO_WQ_WORK_BLKCG |
|
||||
IO_WQ_WORK_FS,
|
||||
IO_WQ_WORK_FS | IO_WQ_WORK_MM,
|
||||
},
|
||||
[IORING_OP_CLOSE] = {
|
||||
.needs_file = 1,
|
||||
@ -921,7 +921,7 @@ static const struct io_op_def io_op_defs[] = {
|
||||
},
|
||||
[IORING_OP_OPENAT2] = {
|
||||
.work_flags = IO_WQ_WORK_FILES | IO_WQ_WORK_FS |
|
||||
IO_WQ_WORK_BLKCG,
|
||||
IO_WQ_WORK_BLKCG | IO_WQ_WORK_MM,
|
||||
},
|
||||
[IORING_OP_EPOLL_CTL] = {
|
||||
.unbound_nonreg_file = 1,
|
||||
@ -3897,7 +3897,7 @@ static int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
{
|
||||
u64 flags, mode;
|
||||
|
||||
if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
|
||||
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
|
||||
return -EINVAL;
|
||||
mode = READ_ONCE(sqe->len);
|
||||
flags = READ_ONCE(sqe->open_flags);
|
||||
@ -3911,7 +3911,7 @@ static int io_openat2_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
size_t len;
|
||||
int ret;
|
||||
|
||||
if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
|
||||
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
|
||||
return -EINVAL;
|
||||
how = u64_to_user_ptr(READ_ONCE(sqe->addr2));
|
||||
len = READ_ONCE(sqe->len);
|
||||
@ -4305,7 +4305,7 @@ static int io_close_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
io_req_init_async(req);
|
||||
req->work.flags |= IO_WQ_WORK_NO_CANCEL;
|
||||
|
||||
if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
|
||||
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
|
||||
return -EINVAL;
|
||||
if (sqe->ioprio || sqe->off || sqe->addr || sqe->len ||
|
||||
sqe->rw_flags || sqe->buf_index)
|
||||
@ -4786,7 +4786,7 @@ static int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
{
|
||||
struct io_accept *accept = &req->accept;
|
||||
|
||||
if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
|
||||
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
|
||||
return -EINVAL;
|
||||
if (sqe->ioprio || sqe->len || sqe->buf_index)
|
||||
return -EINVAL;
|
||||
@ -4827,7 +4827,7 @@ static int io_connect_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
struct io_connect *conn = &req->connect;
|
||||
struct io_async_connect *io = req->async_data;
|
||||
|
||||
if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
|
||||
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
|
||||
return -EINVAL;
|
||||
if (sqe->ioprio || sqe->len || sqe->buf_index || sqe->rw_flags)
|
||||
return -EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user