We need to have our worker count updated before continuing, to avoid
cases where we repeatedly think we need a new worker, but a fork is
already in progress.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
        const struct cred *saved_creds;
 
        struct completion ref_done;
+       struct completion started;
 
        struct rcu_head rcu;
 };
 {
        worker->flags |= (IO_WORKER_F_UP | IO_WORKER_F_RUNNING);
        io_wqe_inc_running(worker);
+       complete(&worker->started);
 }
 
 /*
        worker->wqe = wqe;
        spin_lock_init(&worker->lock);
        init_completion(&worker->ref_done);
+       init_completion(&worker->started);
 
        refcount_inc(&wq->refs);
 
                kfree(worker);
                return false;
        }
+       wait_for_completion(&worker->started);
        return true;
 }