We may enter files cancellation with requests that we want to cancel and that are currently enqueued as task_work. However, before that happens do_exit() sets PF_EXITING, disabling io_run_task_work() and so locking up cancellation. Also, if run between setting PF_EXITING and exit_task_work(), as the case exit_files() and so io_uring cancellation, task_work_add() might actually enqueue more task works. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- fs/io_uring.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 30edf47a8f1a..941fe9b64fd9 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2357,12 +2357,6 @@ static inline unsigned int io_put_rw_kbuf(struct io_kiocb *req) static inline bool io_run_task_work(void) { - /* - * Not safe to run on exiting task, and the task_work handling will - * not add work to such a task. - */ - if (unlikely(current->flags & PF_EXITING)) - return false; if (current->task_works) { __set_current_state(TASK_RUNNING); task_work_run(); -- 2.24.0