aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2012-10-22 14:02:56 -0400
committerJan Schmidt <list.btrfs@jan-o-sch.net>2012-10-23 09:09:14 -0400
commitba1bfbd592c1adddd5d0005f587a6e308e25c949 (patch)
treefa6f07ea288c4798f297e400a7abff38e66f891c /fs
parent57911b8ba814fae01306376a0d02bc7cdc88dc94 (diff)
Btrfs: fix a tree mod logging issue for root replacement operations
Avoid the implicit free by tree_mod_log_set_root_pointer, which is wrong in two places. Where needed, we call tree_mod_log_free_eb explicitly now. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 44a7e25353a6..e6b75ccd2850 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -647,8 +647,6 @@ tree_mod_log_insert_root(struct btrfs_fs_info *fs_info,
647 if (tree_mod_dont_log(fs_info, NULL)) 647 if (tree_mod_dont_log(fs_info, NULL))
648 return 0; 648 return 0;
649 649
650 __tree_mod_log_free_eb(fs_info, old_root);
651
652 ret = tree_mod_alloc(fs_info, flags, &tm); 650 ret = tree_mod_alloc(fs_info, flags, &tm);
653 if (ret < 0) 651 if (ret < 0)
654 goto out; 652 goto out;
@@ -926,12 +924,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
926 ret = btrfs_dec_ref(trans, root, buf, 1, 1); 924 ret = btrfs_dec_ref(trans, root, buf, 1, 1);
927 BUG_ON(ret); /* -ENOMEM */ 925 BUG_ON(ret); /* -ENOMEM */
928 } 926 }
929 /* 927 tree_mod_log_free_eb(root->fs_info, buf);
930 * don't log freeing in case we're freeing the root node, this
931 * is done by tree_mod_log_set_root_pointer later
932 */
933 if (buf != root->node && btrfs_header_level(buf) != 0)
934 tree_mod_log_free_eb(root->fs_info, buf);
935 clean_tree_block(trans, root, buf); 928 clean_tree_block(trans, root, buf);
936 *last_ref = 1; 929 *last_ref = 1;
937 } 930 }
@@ -1728,6 +1721,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1728 goto enospc; 1721 goto enospc;
1729 } 1722 }
1730 1723
1724 tree_mod_log_free_eb(root->fs_info, root->node);
1731 tree_mod_log_set_root_pointer(root, child); 1725 tree_mod_log_set_root_pointer(root, child);
1732 rcu_assign_pointer(root->node, child); 1726 rcu_assign_pointer(root->node, child);
1733 1727