author: Hao Xu <haoxu@linux.alibaba.com> 2021-08-05 18:05:38 +0800
committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2021-08-12 13:32:12 +0200
commit: d92eaad3ed951c5790dc7990850b9979d3f0cb6d
parent: ebad5646c059880bee8ec633ca1c5bd45171fa34
Commit Summary:
Diffstat:
1 file changed, 9 insertions, 1 deletion
diff --git a/fs/io-wq.c b/fs/io-wq.c
index e00ac0969470..400fba839734 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -281,9 +281,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);
}