]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: init worker struct fields before kthread-run
authorShin Hong <hongshin@gmail.com>
Thu, 11 Jun 2009 00:11:29 +0000 (20:11 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 11 Jun 2009 00:11:29 +0000 (20:11 -0400)
commitd93d5265d6b22a36ec5225ed7c61d0c55858c162
tree50b0f3cda5a957bad1090ec4d7bd4e49f43171da
parentdfab6ad3dd35b6d9f27e351e9880c8f5f73f8ada
Btrfs: init worker struct fields before kthread-run

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: Chris Mason <chris.mason@oracle.com>
fs/btrfs/async-thread.c