io-wq: max_worker fixes
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 19 Oct 2021 19:31:26 +0000 (20:31 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 19 Oct 2021 23:09:34 +0000 (17:09 -0600)
commitbc369921d6708542eb93da33478762f1162a5805
treef9ce142cfbdd5091d546acfcc872682b330e6d05
parent14cfbb7a7856f190035f8e53045bdbfa648fae41
io-wq: max_worker fixes

First, fix nr_workers checks against max_workers, with max_worker
registration, it may pretty easily happen that nr_workers > max_workers.

Also, synchronise writing to acct->max_worker with wqe->lock. It's not
an actual problem, but as we don't care about io_wqe_create_worker(),
it's better than WRITE_ONCE()/READ_ONCE().

Fixes: 2e480058ddc2 ("io-wq: provide a way to limit max number of workers")
Reported-by: Beld Zhang <beldzhang@gmail.com>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/11f90e6b49410b7d1a88f5d04fb8d95bb86b8cf3.1634671835.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io-wq.c