Skip to content

Commit 2169827

Browse files
Hao Xuaxboe
authored andcommitted
io-wq: fix lack of acct->nr_workers < acct->max_workers judgement
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 3d4e4fa commit 2169827

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

fs/io-wq.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,17 @@ static void create_worker_cb(struct callback_head *cb)
280280
{
281281
struct create_worker_data *cwd;
282282
struct io_wq *wq;
283+
struct io_wqe *wqe;
284+
struct io_wqe_acct *acct;
283285

284286
cwd = container_of(cb, struct create_worker_data, work);
285-
wq = cwd->wqe->wq;
287+
wqe = cwd->wqe;
288+
wq = wqe->wq;
289+
acct = &wqe->acct[cwd->index];
290+
raw_spin_lock_irq(&wqe->lock);
291+
if (acct->nr_workers < acct->max_workers)
292+
acct->nr_workers++;
293+
raw_spin_unlock_irq(&wqe->lock);
286294
create_io_worker(wq, cwd->wqe, cwd->index);
287295
kfree(cwd);
288296
}

0 commit comments

Comments
 (0)