diff options
author | Jens Axboe <axboe@kernel.dk> | 2022-06-18 09:47:04 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-07-24 18:39:15 -0600 |
commit | 7d8ca7250197096bfa9f432c1d99b0555504bbba (patch) | |
tree | d89bb366d830adc72fa28689dd8b3e9d56c44ab3 /io_uring/cancel.c | |
parent | 88f52eaad2df2cb5ab49b864d79398c9cb9a57f2 (diff) | |
download | linux-stable-7d8ca7250197096bfa9f432c1d99b0555504bbba.tar.gz linux-stable-7d8ca7250197096bfa9f432c1d99b0555504bbba.tar.bz2 linux-stable-7d8ca7250197096bfa9f432c1d99b0555504bbba.zip |
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>
Diffstat (limited to 'io_uring/cancel.c')
-rw-r--r-- | io_uring/cancel.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/io_uring/cancel.c b/io_uring/cancel.c index 500ee5f5fd23..da486de07029 100644 --- a/io_uring/cancel.c +++ b/io_uring/cancel.c @@ -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; |