diff options
author | Jens Axboe <axboe@kernel.dk> | 2021-02-17 04:00:55 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-02-22 03:25:22 +0300 |
commit | bf1daa4bfc77a60e58bed392e659c9ddd0174340 (patch) | |
tree | d6a181062750a59ecc0af77fe74ac9d42b91b040 /fs/io-wq.c | |
parent | 4379bf8bd70b5de6bba7d53015b0c36c57a634ee (diff) | |
download | linux-bf1daa4bfc77a60e58bed392e659c9ddd0174340.tar.xz |
io-wq: only remove worker from free_list, if it was there
If the worker isn't on the free_list, don't attempt to delete it.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io-wq.c')
-rw-r--r-- | fs/io-wq.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/io-wq.c b/fs/io-wq.c index acc67ed3a52c..3a506f1c7838 100644 --- a/fs/io-wq.c +++ b/fs/io-wq.c @@ -155,6 +155,7 @@ static void io_worker_exit(struct io_worker *worker) { struct io_wqe *wqe = worker->wqe; struct io_wqe_acct *acct = io_wqe_get_acct(worker); + unsigned flags; /* * If we're not at zero, someone else is holding a brief reference @@ -167,9 +168,11 @@ static void io_worker_exit(struct io_worker *worker) preempt_disable(); current->flags &= ~PF_IO_WORKER; - if (worker->flags & IO_WORKER_F_RUNNING) + flags = worker->flags; + worker->flags = 0; + if (flags & IO_WORKER_F_RUNNING) atomic_dec(&acct->nr_running); - if (!(worker->flags & IO_WORKER_F_BOUND)) + if (!(flags & IO_WORKER_F_BOUND)) atomic_dec(&wqe->wq->user->processes); worker->flags = 0; preempt_enable(); @@ -180,7 +183,8 @@ static void io_worker_exit(struct io_worker *worker) } raw_spin_lock_irq(&wqe->lock); - hlist_nulls_del_rcu(&worker->nulls_node); + if (flags & IO_WORKER_F_FREE) + hlist_nulls_del_rcu(&worker->nulls_node); list_del_rcu(&worker->all_list); acct->nr_workers--; raw_spin_unlock_irq(&wqe->lock); |