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>
This commit is contained in:
Chris Mason
2008-07-17 12:54:40 -04:00
parent ba1da2f442
commit ee6e6504e1
4 changed files with 21 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ struct btrfs_inode {
struct extent_io_tree io_tree;
struct extent_io_tree io_failure_tree;
struct mutex csum_mutex;
struct mutex extent_mutex;
struct inode vfs_inode;
struct btrfs_ordered_inode_tree ordered_tree;