提交 25e293c2 编写于 作者: W Wang Shilong 提交者: Chris Mason

Btrfs: fix an oops when we fail to merge reloc roots

Previously, we will free reloc root memory and then force filesystem
to be readonly. The problem is that there may be another thread commiting
transaction which will try to access freed reloc root during merging reloc
roots process.

To keep consistency snapshots shared space, we should allow snapshot
finished if possible, so here we don't free reloc root memory.
signed-off-by: NWang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: NJosef Bacik <jbacik@fb.com>
Signed-off-by: NChris Mason <clm@fb.com>
上级 dc4103f9
...@@ -2311,9 +2311,6 @@ void free_reloc_roots(struct list_head *list) ...@@ -2311,9 +2311,6 @@ void free_reloc_roots(struct list_head *list)
reloc_root = list_entry(list->next, struct btrfs_root, reloc_root = list_entry(list->next, struct btrfs_root,
root_list); root_list);
__del_reloc_root(reloc_root); __del_reloc_root(reloc_root);
free_extent_buffer(reloc_root->node);
free_extent_buffer(reloc_root->commit_root);
kfree(reloc_root);
} }
} }
...@@ -2355,10 +2352,9 @@ int merge_reloc_roots(struct reloc_control *rc) ...@@ -2355,10 +2352,9 @@ int merge_reloc_roots(struct reloc_control *rc)
ret = merge_reloc_root(rc, root); ret = merge_reloc_root(rc, root);
if (ret) { if (ret) {
__del_reloc_root(reloc_root); if (list_empty(&reloc_root->root_list))
free_extent_buffer(reloc_root->node); list_add_tail(&reloc_root->root_list,
free_extent_buffer(reloc_root->commit_root); &reloc_roots);
kfree(reloc_root);
goto out; goto out;
} }
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册