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

io_uring/io-wq: fix incorrect io_wq_for_each_worker() termination logic



A previous commit added this helper, and had it terminate if false is
returned from the handler. However, that is completely opposite, it
should abort the loop if true is returned.

Fix this up by having io_wq_for_each_worker() keep iterating as long
as false is returned, and only abort if true is returned.

Cc: stable@vger.kernel.org
Fixes: 751eedc4 ("io_uring/io-wq: move worker lists to struct io_wq_acct")
Reported-by: default avatarLewis Campbell <info@lewiscampbell.tech>
Reviewed-by: default avatarGabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 70eafc74
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -952,11 +952,11 @@ static bool io_wq_for_each_worker(struct io_wq *wq,
				  void *data)
{
	for (int i = 0; i < IO_WQ_ACCT_NR; i++) {
		if (!io_acct_for_each_worker(&wq->acct[i], func, data))
			return false;
		if (io_acct_for_each_worker(&wq->acct[i], func, data))
			return true;
	}

	return true;
	return false;
}

static bool io_wq_worker_wake(struct io_worker *worker, void *data)