diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-10-02 19:36:14 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-19 05:49:54 -0600 |
commit | 6224590d242fc8c6b26941328e02a40b4384949b (patch) | |
tree | 4ffd5a38d9cd36478cb63b4469da87e59ff14303 /fs/io_uring.c | |
parent | 30d51dd4ad2040d4c90497287b69635af7c67502 (diff) | |
download | lwn-6224590d242fc8c6b26941328e02a40b4384949b.tar.gz lwn-6224590d242fc8c6b26941328e02a40b4384949b.zip |
io_uring: add flag to not fail link after timeout
For some reason non-off IORING_OP_TIMEOUT always fails links, it's
pretty inconvenient and unnecessary limits chaining after it to hard
linking, which is far from ideal, e.g. doesn't pair well with timeout
cancellation. Add a flag forcing it to not fail links on -ETIME.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/17c7ec0fb7a6113cc6be8cdaedcada0ba836ac0e.1633199723.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 5b3b52815b88..5b3b4f8f9659 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5857,7 +5857,10 @@ err: static void io_req_task_timeout(struct io_kiocb *req, bool *locked) { - req_set_fail(req); + struct io_timeout_data *data = req->async_data; + + if (!(data->flags & IORING_TIMEOUT_ETIME_SUCCESS)) + req_set_fail(req); io_req_complete_post(req, -ETIME, 0); } @@ -6063,7 +6066,8 @@ static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe, if (off && is_timeout_link) return -EINVAL; flags = READ_ONCE(sqe->timeout_flags); - if (flags & ~(IORING_TIMEOUT_ABS | IORING_TIMEOUT_CLOCK_MASK)) + if (flags & ~(IORING_TIMEOUT_ABS | IORING_TIMEOUT_CLOCK_MASK | + IORING_TIMEOUT_ETIME_SUCCESS)) return -EINVAL; /* more than one clock specified is invalid, obviously */ if (hweight32(flags & IORING_TIMEOUT_CLOCK_MASK) > 1) |