]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix relocation races
authorChris Mason <chris.mason@oracle.com>
Tue, 14 Jun 2011 00:00:16 +0000 (20:00 -0400)
committerChris Mason <chris.mason@oracle.com>
Fri, 17 Jun 2011 17:36:58 +0000 (13:36 -0400)
commit47160702d263d22b19862d38b7420aa15b4203a8
tree2bbef7f61c61b125778d3631237094594b408e0a
parenta7a840b3a92c5d0309b797a632ba4f3ff66ded81
Btrfs: fix relocation races

The recent commit to get rid of our trans_mutex introduced
some races with block group relocation.  The problem is that relocation
needs to do some record keeping about each root, and it was relying
on the transaction mutex to coordinate things in subtle ways.

This fix adds a mutex just for the relocation code and makes sure
it doesn't have a big impact on normal operations.  The race is
really fixed in btrfs_record_root_in_trans, which is where we
step back and wait for the relocation code to finish accounting
setup.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/relocation.c
fs/btrfs/transaction.c