From: Jens Axboe Date: Fri, 3 Dec 2021 02:40:15 +0000 (-0700) Subject: io-wq: don't retry task_work creation failure on fatal conditions X-Git-Tag: baikal/aarch64/sdk6.1~5161^2 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=35159f0320f0cd9d191272a15b6d37797116e063;p=kernel.git 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: 2004e6725fba ("io-wq: make worker creation resilient against signals") Reported-by: Florian Fischer Link: https://lore.kernel.org/io-uring/20211202165606.mqryio4yzubl7ms5@pasture/ Tested-by: Florian Fischer Signed-off-by: Jens Axboe --- diff --git a/fs/io-wq.c b/fs/io-wq.c index 88202de519f6d..50cf9f92da361 100644 --- a/fs/io-wq.c +++ b/fs/io-wq.c @@ -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: