summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-09-24 12:50:10 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 15:41:59 -0400
commit4434c33c7f233a7ee5dcaf357fbf795818ea8861 (patch)
tree76ba6f9d94368b176aff788a29449fe759512043 /fs
parent2b1f55b0f0d0d1a66470ef4ea2696cd5dd741a12 (diff)
downloadlwn-4434c33c7f233a7ee5dcaf357fbf795818ea8861.tar.gz
lwn-4434c33c7f233a7ee5dcaf357fbf795818ea8861.zip
Btrfs: fix sleep with spinlock held during unmount
The code to free block groups needs to drop the space info spin lock before calling btrfs_remove_free_space_cache (which can schedule). This is safe because at unmount time, nobody else is going to play with the block groups. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 5258923d621f..fe4e11b31a43 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3157,9 +3157,13 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
block_group = rb_entry(n, struct btrfs_block_group_cache,
cache_node);
+ spin_unlock(&info->block_group_cache_lock);
btrfs_remove_free_space_cache(block_group);
+ spin_lock(&info->block_group_cache_lock);
+
rb_erase(&block_group->cache_node,
&info->block_group_cache_tree);
+
spin_lock(&block_group->space_info->lock);
list_del(&block_group->list);
spin_unlock(&block_group->space_info->lock);