Skip to content

Commit 7cfe7a0

Browse files
committed
io_uring: clear TIF_NOTIFY_SIGNAL if set and task_work not available
With how task_work is added and signaled, we can have TIF_NOTIFY_SIGNAL set and no task_work pending as it got run in a previous loop. Treat TIF_NOTIFY_SIGNAL like get_signal(), always clear it if set regardless of whether or not task_work is pending to run. Cc: stable@vger.kernel.org Fixes: 46a525e ("io_uring: don't gate task_work run on TIF_NOTIFY_SIGNAL") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 12ad3d2 commit 7cfe7a0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

io_uring/io_uring.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,14 @@ static inline unsigned int io_sqring_entries(struct io_ring_ctx *ctx)
238238

239239
static inline int io_run_task_work(void)
240240
{
241+
/*
242+
* Always check-and-clear the task_work notification signal. With how
243+
* signaling works for task_work, we can find it set with nothing to
244+
* run. We need to clear it for that case, like get_signal() does.
245+
*/
246+
if (test_thread_flag(TIF_NOTIFY_SIGNAL))
247+
clear_notify_signal();
241248
if (task_work_pending(current)) {
242-
if (test_thread_flag(TIF_NOTIFY_SIGNAL))
243-
clear_notify_signal();
244249
__set_current_state(TASK_RUNNING);
245250
task_work_run();
246251
return 1;

0 commit comments

Comments
 (0)