summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>2013-12-11 12:29:52 +0100
committerChris Mason <clm@fb.com>2013-12-12 16:12:51 +0100
commit467bb1d27c0b783b73e6349304c0d90b5b4f431b (patch)
tree0c425a7f15c52b005cf3265af284cec5597d0a78 /fs/btrfs/relocation.c
parentBtrfs: skip building backref tree for uuid and quota tree when doing balance ... (diff)
downloadlinux-467bb1d27c0b783b73e6349304c0d90b5b4f431b.tar.xz
linux-467bb1d27c0b783b73e6349304c0d90b5b4f431b.zip
Btrfs: make sure we cleanup all reloc roots if error happens
I hit an oops when merging reloc roots fails, the reason is that new reloc roots may be added and we should make sure we cleanup all reloc roots. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to '')
-rw-r--r--fs/btrfs/relocation.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 0a3f02562053..429c73c374b8 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2409,6 +2409,13 @@ out:
btrfs_std_error(root->fs_info, ret);
if (!list_empty(&reloc_roots))
free_reloc_roots(&reloc_roots);
+
+ /* new reloc root may be added */
+ mutex_lock(&root->fs_info->reloc_mutex);
+ list_splice_init(&rc->reloc_roots, &reloc_roots);
+ mutex_unlock(&root->fs_info->reloc_mutex);
+ if (!list_empty(&reloc_roots))
+ free_reloc_roots(&reloc_roots);
}
BUG_ON(!RB_EMPTY_ROOT(&rc->reloc_root_tree.rb_root));