aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-07-17 12:54:40 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:04 -0400
commitee6e6504e147a59a9f4d582662c105e9d72ae638 (patch)
treebe932cc04abb860ed76ab8d4c4c28353ed50bebb /fs/btrfs/extent-tree.c
parentba1da2f442ec91a1534afa893f9bef7e33056ace (diff)
Add a per-inode lock around btrfs_drop_extents
btrfs_drop_extents is always called with a range lock held on the inode. But, it may operate on extents outside that range as it drops and splits them. This patch adds a per-inode mutex that is held while calling btrfs_drop_extents and while inserting new extents into the tree. It prevents races from two procs working against adjacent ranges in the tree. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 343d1101c31c..4036c62b6671 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1671,6 +1671,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
1671 ret = __free_extent(trans, root, bytenr, num_bytes, root_objectid, 1671 ret = __free_extent(trans, root, bytenr, num_bytes, root_objectid,
1672 ref_generation, owner_objectid, owner_offset, 1672 ref_generation, owner_objectid, owner_offset,
1673 pin, pin == 0); 1673 pin, pin == 0);
1674
1675 finish_current_insert(trans, root->fs_info->extent_root);
1674 pending_ret = del_pending_extents(trans, root->fs_info->extent_root); 1676 pending_ret = del_pending_extents(trans, root->fs_info->extent_root);
1675 return ret ? ret : pending_ret; 1677 return ret ? ret : pending_ret;
1676} 1678}