提交 6e5cbea1 编写于 作者: D Daniele Albano 提交者: Caspar Zhang

io_uring: always allow drain/link/hardlink/async sqe flags

to #29608102

commit 61710e437f2807e26a3402543bdbb7217a9c8620 upstream.

We currently filter these for timeout_remove/async_cancel/files_update,
but we only should be filtering for fixed file and buffer select. This
also causes a second read of sqe->flags, which isn't needed.

Just check req->flags for the relevant bits. This then allows these
commands to be used in links, for example, like everything else.
Signed-off-by: NDaniele Albano <d.albano@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
上级 8d834b0c
...@@ -4699,7 +4699,9 @@ static int io_timeout_remove_prep(struct io_kiocb *req, ...@@ -4699,7 +4699,9 @@ static int io_timeout_remove_prep(struct io_kiocb *req,
{ {
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
return -EINVAL; return -EINVAL;
if (sqe->flags || sqe->ioprio || sqe->buf_index || sqe->len) if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
return -EINVAL;
if (sqe->ioprio || sqe->buf_index || sqe->len)
return -EINVAL; return -EINVAL;
req->timeout.addr = READ_ONCE(sqe->addr); req->timeout.addr = READ_ONCE(sqe->addr);
...@@ -4877,8 +4879,9 @@ static int io_async_cancel_prep(struct io_kiocb *req, ...@@ -4877,8 +4879,9 @@ static int io_async_cancel_prep(struct io_kiocb *req,
{ {
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
return -EINVAL; return -EINVAL;
if (sqe->flags || sqe->ioprio || sqe->off || sqe->len || if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
sqe->cancel_flags) return -EINVAL;
if (sqe->ioprio || sqe->off || sqe->len || sqe->cancel_flags)
return -EINVAL; return -EINVAL;
req->cancel.addr = READ_ONCE(sqe->addr); req->cancel.addr = READ_ONCE(sqe->addr);
...@@ -4896,7 +4899,9 @@ static int io_async_cancel(struct io_kiocb *req) ...@@ -4896,7 +4899,9 @@ static int io_async_cancel(struct io_kiocb *req)
static int io_files_update_prep(struct io_kiocb *req, static int io_files_update_prep(struct io_kiocb *req,
const struct io_uring_sqe *sqe) const struct io_uring_sqe *sqe)
{ {
if (sqe->flags || sqe->ioprio || sqe->rw_flags) if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
return -EINVAL;
if (sqe->ioprio || sqe->rw_flags)
return -EINVAL; return -EINVAL;
req->files_update.offset = READ_ONCE(sqe->off); req->files_update.offset = READ_ONCE(sqe->off);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册