mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-17 12:34:01 +00:00
io_uring: add IORING_ASYNC_CANCEL_FD_FIXED cancel flag
In preparation for not having a request to pass in that carries this state, add a separate cancelation flag that allows the caller to ask for a fixed file for cancelation. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
88f52eaad2
commit
7d8ca72501
2 changed files with 8 additions and 3 deletions
|
@ -247,10 +247,12 @@ enum io_uring_op {
|
|||
* IORING_ASYNC_CANCEL_FD Key off 'fd' for cancelation rather than the
|
||||
* request 'user_data'
|
||||
* IORING_ASYNC_CANCEL_ANY Match any request
|
||||
* IORING_ASYNC_CANCEL_FD_FIXED 'fd' passed in is a fixed descriptor
|
||||
*/
|
||||
#define IORING_ASYNC_CANCEL_ALL (1U << 0)
|
||||
#define IORING_ASYNC_CANCEL_FD (1U << 1)
|
||||
#define IORING_ASYNC_CANCEL_ANY (1U << 2)
|
||||
#define IORING_ASYNC_CANCEL_FD_FIXED (1U << 3)
|
||||
|
||||
/*
|
||||
* send/sendmsg and recv/recvmsg flags (sqe->ioprio)
|
||||
|
|
|
@ -24,7 +24,7 @@ struct io_cancel {
|
|||
};
|
||||
|
||||
#define CANCEL_FLAGS (IORING_ASYNC_CANCEL_ALL | IORING_ASYNC_CANCEL_FD | \
|
||||
IORING_ASYNC_CANCEL_ANY)
|
||||
IORING_ASYNC_CANCEL_ANY | IORING_ASYNC_CANCEL_FD_FIXED)
|
||||
|
||||
static bool io_cancel_cb(struct io_wq_work *work, void *data)
|
||||
{
|
||||
|
@ -174,11 +174,14 @@ int io_async_cancel(struct io_kiocb *req, unsigned int issue_flags)
|
|||
int ret;
|
||||
|
||||
if (cd.flags & IORING_ASYNC_CANCEL_FD) {
|
||||
if (req->flags & REQ_F_FIXED_FILE)
|
||||
if (req->flags & REQ_F_FIXED_FILE ||
|
||||
cd.flags & IORING_ASYNC_CANCEL_FD_FIXED) {
|
||||
req->flags |= REQ_F_FIXED_FILE;
|
||||
req->file = io_file_get_fixed(req, cancel->fd,
|
||||
issue_flags);
|
||||
else
|
||||
} else {
|
||||
req->file = io_file_get_normal(req, cancel->fd);
|
||||
}
|
||||
if (!req->file) {
|
||||
ret = -EBADF;
|
||||
goto done;
|
||||
|
|
Loading…
Add table
Reference in a new issue