diff options
author | Yan Zheng <zheng.yan@oracle.com> | 2009-02-12 14:14:53 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-02-12 14:14:53 -0500 |
commit | 2456242530a21cfee82646ebeeda65d3f74faa4c (patch) | |
tree | c0e8f5eda96cefeb44a48f05a248ea22b4259ad2 /fs/btrfs/transaction.c | |
parent | 4008c04a07c73ec3cb1be4c1391d2159a8f75d6d (diff) |
Btrfs: hold trans_mutex when using btrfs_record_root_in_trans
btrfs_record_root_in_trans needs the trans_mutex held to make sure two
callers don't race to setup the root in a given transaction. This adds
it to all the places that were missing it.
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 919172de5c9a..4112d53d4f4d 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -688,7 +688,9 @@ static noinline int drop_dirty_roots(struct btrfs_root *tree_root, | |||
688 | num_bytes -= btrfs_root_used(&dirty->root->root_item); | 688 | num_bytes -= btrfs_root_used(&dirty->root->root_item); |
689 | bytes_used = btrfs_root_used(&root->root_item); | 689 | bytes_used = btrfs_root_used(&root->root_item); |
690 | if (num_bytes) { | 690 | if (num_bytes) { |
691 | mutex_lock(&root->fs_info->trans_mutex); | ||
691 | btrfs_record_root_in_trans(root); | 692 | btrfs_record_root_in_trans(root); |
693 | mutex_unlock(&root->fs_info->trans_mutex); | ||
692 | btrfs_set_root_used(&root->root_item, | 694 | btrfs_set_root_used(&root->root_item, |
693 | bytes_used - num_bytes); | 695 | bytes_used - num_bytes); |
694 | } | 696 | } |