提交 978d910d 编写于 作者: Y Yan Zheng 提交者: Chris Mason

Btrfs: always update root items for fs trees at commit time

commit_fs_roots skips updating root items for fs trees that aren't modified.
This is unsafe now that relocation code modifies root item's last_snapshot
field without modifying corresponding fs tree.
Signed-off-by: NYan Zheng <zheng.yan@oracle.com>
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 b263c2c8
...@@ -543,13 +543,13 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans, ...@@ -543,13 +543,13 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans,
btrfs_free_log(trans, root); btrfs_free_log(trans, root);
btrfs_update_reloc_root(trans, root); btrfs_update_reloc_root(trans, root);
if (root->commit_root == root->node) if (root->commit_root != root->node) {
continue;
free_extent_buffer(root->commit_root); free_extent_buffer(root->commit_root);
root->commit_root = btrfs_root_node(root); root->commit_root = btrfs_root_node(root);
btrfs_set_root_node(&root->root_item,
root->node);
}
btrfs_set_root_node(&root->root_item, root->node);
err = btrfs_update_root(trans, fs_info->tree_root, err = btrfs_update_root(trans, fs_info->tree_root,
&root->root_key, &root->root_key,
&root->root_item); &root->root_item);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册