io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] io_uring: fail links of cancelled timeouts
@ 2021-09-09 12:56 Pavel Begunkov
  2021-09-09 15:41 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-09-09 12:56 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: asml.silence

When we cancel a timeout we should mark it with REQ_F_FAIL, so
linked requests are cancelled as well, but not queued for further
execution.

Cc: stable@vger.kernel.org
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/io_uring.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index aabc2b489831..e6ccdae189b0 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1486,6 +1486,8 @@ static void io_kill_timeout(struct io_kiocb *req, int status)
 	struct io_timeout_data *io = req->async_data;
 
 	if (hrtimer_try_to_cancel(&io->timer) != -1) {
+		if (status)
+			req_set_fail(req);
 		atomic_set(&req->ctx->cq_timeouts,
 			atomic_read(&req->ctx->cq_timeouts) + 1);
 		list_del_init(&req->timeout.list);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] io_uring: fail links of cancelled timeouts
  2021-09-09 12:56 [PATCH] io_uring: fail links of cancelled timeouts Pavel Begunkov
@ 2021-09-09 15:41 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-09-09 15:41 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 9/9/21 6:56 AM, Pavel Begunkov wrote:
> When we cancel a timeout we should mark it with REQ_F_FAIL, so
> linked requests are cancelled as well, but not queued for further
> execution.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-09 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09 12:56 [PATCH] io_uring: fail links of cancelled timeouts Pavel Begunkov
2021-09-09 15:41 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).