Skip to content

Commit

Permalink
io-wq: don't retry task_work creation failure on fatal conditions
Browse files Browse the repository at this point in the history
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 <florian.fl.fischer@fau.de>
Link: https://lore.kernel.org/io-uring/20211202165606.mqryio4yzubl7ms5@pasture/
Tested-by: Florian Fischer <florian.fl.fischer@fau.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Dec 3, 2021
1 parent f6223ff commit a226abc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/io-wq.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,13 @@ static bool io_wq_work_match_all(struct io_wq_work *work, void *data)

static inline bool io_should_retry_thread(long err)
{
/*
* Prevent perpetual task_work retry, if the task (or its group) is
* exiting.
*/
if (fatal_signal_pending(current))
return false;

switch (err) {
case -EAGAIN:
case -ERESTARTSYS:
Expand Down

0 comments on commit a226abc

Please sign in to comment.