• Jens Axboe's avatar
    io-wq: fix races around manager/worker creation and task exit · 8b3e78b5
    Jens Axboe authored
    These races have always been there, they are just more apparent now that
    we do early cancel of io-wq when the task exits.
    
    Ensure that the io-wq manager sets task state correctly to not miss
    wakeups for task creation. This is important if we get a wakeup after
    having marked ourselves as TASK_INTERRUPTIBLE. If we do end up creating
    workers, then we flip the state back to running, making the subsequent
    schedule() a no-op. Also increment the wq ref count before forking the
    thread, to avoid a use-after-free.
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    8b3e78b5
io-wq.c 25.1 KB