This is a note to let you know that I've just added the patch titled io_uring: handle TIF_NOTIFY_RESUME when checking for task_work to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: io_uring-handle-tif_notify_resume-when-checking-for-task_work.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 6c2a4a822d8e9862615f51037ffa2ee9668a7850 Mon Sep 17 00:00:00 2001 From: Jens Axboe <axboe@xxxxxxxxx> Date: Mon, 6 Mar 2023 13:15:06 -0700 Subject: io_uring: handle TIF_NOTIFY_RESUME when checking for task_work From: Jens Axboe <axboe@xxxxxxxxx> commit b5d3ae202fbfe055aa2a8ae8524531ee1dcab717 upstream. If TIF_NOTIFY_RESUME is set, then we need to call resume_user_mode_work() for PF_IO_WORKER threads. They never return to usermode, hence never get a chance to process any items that are marked by this flag. Most notably this includes the final put of files, but also any throttling markers set by block cgroups. Cc: stable@xxxxxxxxxxxxxxx # 5.10+ Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- io_uring/io_uring.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -2460,6 +2460,13 @@ static inline unsigned int io_put_rw_kbu static inline bool io_run_task_work(void) { + /* + * PF_IO_WORKER never returns to userspace, so check here if we have + * notify work that needs processing. + */ + if (current->flags & PF_IO_WORKER && + test_thread_flag(TIF_NOTIFY_RESUME)) + tracehook_notify_resume(NULL); if (test_thread_flag(TIF_NOTIFY_SIGNAL) || current->task_works) { __set_current_state(TASK_RUNNING); tracehook_notify_signal(); Patches currently in stable-queue which might be from axboe@xxxxxxxxx are queue-5.10/s390-dasd-prepare-for-additional-path-event-handling.patch queue-5.10/io_uring-handle-tif_notify_resume-when-checking-for-task_work.patch queue-5.10/brd-return-0-error-from-brd_insert_page.patch queue-5.10/fs-hfsplus-fix-uaf-issue-in-hfsplus_put_super.patch queue-5.10/blk-mq-avoid-sleep-in-blk_mq_alloc_request_hctx.patch queue-5.10/io_uring-remove-msg_nosignal-from-recvmsg.patch queue-5.10/io_uring-mark-task-task_running-before-handling-resume-task-work.patch queue-5.10/io_uring-rsrc-disallow-multi-source-reg-buffers.patch queue-5.10/io_uring-poll-allow-some-retries-for-poll-triggering-spuriously.patch queue-5.10/blk-mq-remove-stale-comment-for-blk_mq_sched_mark_re.patch queue-5.10/blk-iocost-fix-divide-by-0-error-in-calc_lcoefs.patch queue-5.10/s390-dasd-fix-potential-memleak-in-dasd_eckd_init.patch queue-5.10/blk-mq-correct-stale-comment-of-.get_budget.patch queue-5.10/io_uring-add-a-conditional-reschedule-to-the-iopoll-cancelation-loop.patch queue-5.10/block-bio-integrity-copy-flags-when-bio_integrity_pa.patch