• Shin Hong's avatar
    Btrfs: init worker struct fields before kthread-run · fd0fb038
    Shin Hong authored
    This patch fixes a bug which may result race condition
    between btrfs_start_workers() and worker_loop().
    
    btrfs_start_workers() executed in a parent thread writes
    on workers->worker and worker_loop() in a child thread
    reads workers->worker. However, there is no synchronization
    enforcing the order of two operations.
    
    This patch makes btrfs_start_workers() fill workers->worker
    before it starts a child thread with worker_loop()
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    fd0fb038
async-thread.c 13 KB