aboutsummaryrefslogtreecommitdiffstats
path: root/io_uring/uring_cmd.c
diff options
context:
space:
mode:
authorJens Axboe <[email protected]>2025-09-18 16:21:14 +0000
committerJens Axboe <[email protected]>2025-09-18 16:24:50 +0000
commit3539b1467e94336d5854ebf976d9627bfb65d6c3 (patch)
treea6bbcfb9ea4bea836fcfb2a66e94fe0f7f64413b /io_uring/uring_cmd.c
parentio_uring/io-wq: fix `max_workers` breakage and `nr_workers` underflow (diff)
downloadkernel-3539b1467e94336d5854ebf976d9627bfb65d6c3.tar.gz
kernel-3539b1467e94336d5854ebf976d9627bfb65d6c3.zip
io_uring: include dying ring in task_work "should cancel" state
When running task_work for an exiting task, rather than perform the issue retry attempt, the task_work is canceled. However, this isn't done for a ring that has been closed. This can lead to requests being successfully completed post the ring being closed, which is somewhat confusing and surprising to an application. Rather than just check the task exit state, also include the ring ref state in deciding whether or not to terminate a given request when run from task_work. Cc: [email protected] # 6.1+ Link: https://github.com/axboe/liburing/discussions/1459 Reported-by: Benedek Thaler <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'io_uring/uring_cmd.c')
-rw-r--r--io_uring/uring_cmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index 053bac89b6c0..213716e10d70 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -118,7 +118,7 @@ static void io_uring_cmd_work(struct io_kiocb *req, io_tw_token_t tw)
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
unsigned int flags = IO_URING_F_COMPLETE_DEFER;
- if (io_should_terminate_tw())
+ if (io_should_terminate_tw(req->ctx))
flags |= IO_URING_F_TASK_DEAD;
/* task_work executor checks the deffered list completion */