• yanhai zhu's avatar
    Btrfs: Check kthread_should_stop() before schedule() in worker_loop · 0df49b91
    yanhai zhu authored
    In worker_loop(), the func should check whether it has been requested to stop
    before it decides to schedule out.
    
    Otherwise if the stop request(also the last wake_up()) sent by
    btrfs_stop_workers() happens when worker_loop() running after the "while"
    judgement and before schedule(), woker_loop() will schedule away and never be
    woken up, which will also cause btrfs_stop_workers() wait forever.
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    0df49b91
async-thread.c 11 KB