Skip to content

Commit a226abc

Browse files
committed
io-wq: don't retry task_work creation failure on fatal conditions
We don't want to be retrying task_work creation failure if there's an actual signal pending for the parent task. If we do, then we can enter an infinite loop of perpetually retrying and each retry failing with -ERESTARTNOINTR because a signal is pending. Fixes: 3146cba ("io-wq: make worker creation resilient against signals") Reported-by: Florian Fischer <[email protected]> Link: https://lore.kernel.org/io-uring/20211202165606.mqryio4yzubl7ms5@pasture/ Tested-by: Florian Fischer <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent f6223ff commit a226abc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/io-wq.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,13 @@ static bool io_wq_work_match_all(struct io_wq_work *work, void *data)
714714

715715
static inline bool io_should_retry_thread(long err)
716716
{
717+
/*
718+
* Prevent perpetual task_work retry, if the task (or its group) is
719+
* exiting.
720+
*/
721+
if (fatal_signal_pending(current))
722+
return false;
723+
717724
switch (err) {
718725
case -EAGAIN:
719726
case -ERESTARTSYS:

0 commit comments

Comments
 (0)