diff options
author | Yan Zheng <zheng.yan@oracle.com> | 2009-06-15 20:01:02 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-06-15 20:01:02 -0400 |
commit | 978d910d31c5202e251298bf3f603300a54605dd (patch) | |
tree | 69a5c7a2f1fac9b98dcc3bc95d9214686d487f16 /fs | |
parent | b263c2c8bf13c273485bd99dbbeba79c844409dd (diff) |
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: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/transaction.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 2e177d7f4bb9..4e83457ea253 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -543,13 +543,13 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans, | |||
543 | btrfs_free_log(trans, root); | 543 | btrfs_free_log(trans, root); |
544 | btrfs_update_reloc_root(trans, root); | 544 | btrfs_update_reloc_root(trans, root); |
545 | 545 | ||
546 | if (root->commit_root == root->node) | 546 | if (root->commit_root != root->node) { |
547 | continue; | 547 | free_extent_buffer(root->commit_root); |
548 | 548 | root->commit_root = btrfs_root_node(root); | |
549 | free_extent_buffer(root->commit_root); | 549 | btrfs_set_root_node(&root->root_item, |
550 | root->commit_root = btrfs_root_node(root); | 550 | root->node); |
551 | } | ||
551 | 552 | ||
552 | btrfs_set_root_node(&root->root_item, root->node); | ||
553 | err = btrfs_update_root(trans, fs_info->tree_root, | 553 | err = btrfs_update_root(trans, fs_info->tree_root, |
554 | &root->root_key, | 554 | &root->root_key, |
555 | &root->root_item); | 555 | &root->root_item); |