io_uring: mark task TASK_RUNNING before handling resume/task work
authorJens Axboe <axboe@kernel.dk>
Mon, 6 Mar 2023 20:16:38 +0000 (13:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:40:04 +0000 (09:40 +0100)
commit337eb887c74d05fbe603ac7fcd33c3ac0612d24a
treebc81f1188dd085099f77b8e436f6492e21ce2bf4
parent54df6c5edf87df71f8a144ee6e0f04cde180aea2
io_uring: mark task TASK_RUNNING before handling resume/task work

commit 2f2bb1ffc9983e227424d0787289da5483b0c74f upstream.

Just like for task_work, set the task mode to TASK_RUNNING before doing
potential resume work. We're not holding any locks at this point,
but we may have already set the task state to TASK_INTERRUPTIBLE in
preparation for going to sleep waiting for events. Ensure that we set it
back to TASK_RUNNING if we have work to process, to avoid warnings on
calling blocking operations with !TASK_RUNNING.

Fixes: b5d3ae202fbf ("io_uring: handle TIF_NOTIFY_RESUME when checking for task_work")
Reported-by: kernel test robot <oliver.sang@intel.com>
Link: https://lore.kernel.org/oe-lkp/202302062208.24d3e563-oliver.sang@intel.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/io_uring.c