Skip to content

Commit

Permalink
io-wq: fix lack of acct->nr_workers < acct->max_workers judgement
Browse files Browse the repository at this point in the history
There should be this judgement before we create an io-worker

Fixes: 685fe7f ("io-wq: eliminate the need for a manager thread")
Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Hao Xu authored and axboe committed Aug 6, 2021
1 parent 3d4e4fa commit 2169827
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fs/io-wq.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,17 @@ static void create_worker_cb(struct callback_head *cb)
{
struct create_worker_data *cwd;
struct io_wq *wq;
struct io_wqe *wqe;
struct io_wqe_acct *acct;

cwd = container_of(cb, struct create_worker_data, work);
wq = cwd->wqe->wq;
wqe = cwd->wqe;
wq = wqe->wq;
acct = &wqe->acct[cwd->index];
raw_spin_lock_irq(&wqe->lock);
if (acct->nr_workers < acct->max_workers)
acct->nr_workers++;
raw_spin_unlock_irq(&wqe->lock);
create_io_worker(wq, cwd->wqe, cwd->index);
kfree(cwd);
}
Expand Down

0 comments on commit 2169827

Please sign in to comment.