io-wq: don't ask for a new worker if we're exiting
authorJens Axboe <axboe@kernel.dk>
Fri, 26 Feb 2021 16:52:02 +0000 (09:52 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 4 Mar 2021 13:32:53 +0000 (06:32 -0700)
If we're in the process of shutting down the async context, then don't
create new workers if we already have at least the fixed one.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io-wq.c

index 1d01edada8aab43a03098086ec099f5b4a2c7783..2f9d7ee12ee1a373f66d0043a97feff2ebfadbde 100644 (file)
@@ -673,6 +673,8 @@ static inline bool io_wqe_need_worker(struct io_wqe *wqe, int index)
 {
        struct io_wqe_acct *acct = &wqe->acct[index];
 
+       if (acct->nr_workers && test_bit(IO_WQ_BIT_EXIT, &wqe->wq->state))
+               return false;
        /* if we have available workers or no work, no need */
        if (!hlist_nulls_empty(&wqe->free_list) || !io_wqe_run_queue(wqe))
                return false;