public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix locking issue in btrfs_remove_block_group
@ 2009-01-21 11:53 Yan Zheng
  0 siblings, 0 replies; only message in thread
From: Yan Zheng @ 2009-01-21 11:53 UTC (permalink / raw)
  To: linux-btrfs, chris Mason

hello,

We should hold the block_group_cache_lock while modifying the
block groups red-black tree. Thank you,

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>

---
diff -urp 1/fs/btrfs/extent-tree.c 2/fs/btrfs/extent-tree.c
--- 1/fs/btrfs/extent-tree.c	2009-01-07 07:16:42.762364700 +0800
+++ 2/fs/btrfs/extent-tree.c	2009-01-21 10:41:38.000000000 +0800
@@ -5957,9 +5957,11 @@ int btrfs_remove_block_group(struct btrf
 	path = btrfs_alloc_path();
 	BUG_ON(!path);
 
-	btrfs_remove_free_space_cache(block_group);
+	spin_lock(&root->fs_info->block_group_cache_lock);
 	rb_erase(&block_group->cache_node,
 		 &root->fs_info->block_group_cache_tree);
+	spin_unlock(&root->fs_info->block_group_cache_lock);
+	btrfs_remove_free_space_cache(block_group);
 	down_write(&block_group->space_info->groups_sem);
 	list_del(&block_group->list);
 	up_write(&block_group->space_info->groups_sem);




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-21 11:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-21 11:53 [PATCH] Fix locking issue in btrfs_remove_block_group Yan Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox