]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
io-wq: warn on creating manager while exiting
authorPavel Begunkov <asml.silence@gmail.com>
Sat, 6 Mar 2021 11:02:18 +0000 (11:02 +0000)
committerJens Axboe <axboe@kernel.dk>
Sun, 7 Mar 2021 21:12:43 +0000 (14:12 -0700)
Add a simple warning making sure that nobody tries to create a new
manager while we're under IO_WQ_BIT_EXIT. That can potentially happen
due to racy work submission after final put.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io-wq.c

index 1bfdb86336e49b9627e40ffc60913cbad13e4b69..1ab9324e602f5918da5ee42fc00059dc5b4deda6 100644 (file)
@@ -774,6 +774,8 @@ static int io_wq_fork_manager(struct io_wq *wq)
        if (wq->manager)
                return 0;
 
+       WARN_ON_ONCE(test_bit(IO_WQ_BIT_EXIT, &wq->state));
+
        init_completion(&wq->worker_done);
        atomic_set(&wq->worker_refs, 1);
        tsk = create_io_thread(io_wq_manager, wq, NUMA_NO_NODE);