]> 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)
commita8d11ce8601c7b14a5bee83f538e0e5bc09d9944
tree2bbef7f61c61b125778d3631237094594b408e0a
parent01202f4169393f128e6844f6a347b255ce2cf46f
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