Commit 81609589 authored by Jens Axboe's avatar Jens Axboe
Browse files

io_uring/io-wq: handle !sysctl_hung_task_timeout_secs



If the hung_task_timeout sysctl is set to 0, then we'll end up busy
looping inside io_wq_exit_workers() after an earlier commit switched to
using wait_for_completion_timeout(). Use the maximum schedule timeout
value for that case.

Fixes: 1f293098 ("io_uring/io-wq: don't trigger hung task for syzbot craziness")
Reported-by: default avatarChris Mason <clm@fb.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 1edf0891
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1340,6 +1340,8 @@ static void io_wq_exit_workers(struct io_wq *wq)
	 * up waiting more than IO_URING_EXIT_WAIT_MAX.
	 */
	timeout = sysctl_hung_task_timeout_secs * HZ / 2;
	if (!timeout)
		timeout = MAX_SCHEDULE_TIMEOUT;
	warn_timeout = jiffies + IO_URING_EXIT_WAIT_MAX;
	do {
		if (wait_for_completion_timeout(&wq->worker_done, timeout))