diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-06-25 16:01:30 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:03 -0400 |
commit | 5cd57b2cbbb06a350df2698314e4e6a80805fc2f (patch) | |
tree | cd20c904dd016ab031af582dadfbd6e04bf4df9e /fs/btrfs/extent-tree.c | |
parent | 168fd7d271d9d8e81ff0b03eb08c36d82670c8a9 (diff) |
Btrfs: Add a skip_locking parameter to struct path, and make various funcs honor it
Allocations may need to read in block groups from the extent allocation tree,
which will require a tree search and take locks on the extent allocation
tree. But, those locks might already be held in other places, leading
to deadlocks.
Since the alloc_mutex serializes everything right now, it is safe to
skip the btree locking while caching block groups. A better fix will be
to either create a recursive lock or find a way to back off existing
locks while caching block groups.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 0905653dd3fc..544fc3f2fe6c 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -88,6 +88,12 @@ static int cache_block_group(struct btrfs_root *root, | |||
88 | return -ENOMEM; | 88 | return -ENOMEM; |
89 | 89 | ||
90 | path->reada = 2; | 90 | path->reada = 2; |
91 | /* | ||
92 | * we get into deadlocks with paths held by callers of this function. | ||
93 | * since the alloc_mutex is protecting things right now, just | ||
94 | * skip the locking here | ||
95 | */ | ||
96 | path->skip_locking = 1; | ||
91 | first_free = block_group->key.objectid; | 97 | first_free = block_group->key.objectid; |
92 | key.objectid = block_group->key.objectid; | 98 | key.objectid = block_group->key.objectid; |
93 | key.offset = 0; | 99 | key.offset = 0; |