public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH for-next] io_uring: mark task TASK_RUNNING before handling resume/task work
@ 2023-02-06 15:25 Jens Axboe
  0 siblings, 0 replies; only message in thread
From: Jens Axboe @ 2023-02-06 15:25 UTC (permalink / raw)
  To: io-uring; +Cc: kernel test robot

Just like for task_work, set the task mode to TASK_RUNNING before doing
any 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 <[email protected]>
Link: https://lore.kernel.org/oe-lkp/[email protected]
Signed-off-by: Jens Axboe <[email protected]>

---

diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index f90816aac896..2711865f1e19 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -281,8 +281,10 @@ static inline int io_run_task_work(void)
 	 * notify work that needs processing.
 	 */
 	if (current->flags & PF_IO_WORKER &&
-	    test_thread_flag(TIF_NOTIFY_RESUME))
+	    test_thread_flag(TIF_NOTIFY_RESUME)) {
+		__set_current_state(TASK_RUNNING);
 		resume_user_mode_work(NULL);
+	}
 	if (task_work_pending(current)) {
 		__set_current_state(TASK_RUNNING);
 		task_work_run();

-- 
Jens Axboe

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-06 15:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-06 15:25 [PATCH for-next] io_uring: mark task TASK_RUNNING before handling resume/task work Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox