io-wq: exclusively gate signal based exit on get_signal() return

io-wq threads block all signals, except SIGKILL and SIGSTOP. We should not
need any extra checking of signal_pending or fatal_signal_pending, rely
exclusively on whether or not get_signal() tells us to exit.

The original debugging of this issue led to the false positive that we
were exiting on non-fatal signals, but that is not the case. The issue
was around races with nr_workers accounting.

Fixes: 87c1696655 ("io-wq: ensure we exit if thread group is exiting")
Fixes: 15e20db2e0 ("io-wq: only exit on fatal signals")
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe 2021-09-27 10:04:10 -06:00
parent 7df778be2f
commit 78f8876c2d

View file

@ -584,10 +584,7 @@ static int io_wqe_worker(void *data)
if (!get_signal(&ksig))
continue;
if (fatal_signal_pending(current) ||
signal_group_exit(current->signal))
break;
continue;
break;
}
last_timeout = !ret;
}