From: Yan Date: Fri, 1 Feb 2008 19:58:07 +0000 (-0500) Subject: Call btrfs_cow_block while lowering tree level. X-Git-Tag: v2.6.29-rc1~27^2~9^2~55^2~56^2~30^2~300 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2f375ab9c55bf22bf77ed9e3082b93e77ea10f55;p=karo-tx-linux.git Call btrfs_cow_block while lowering tree level. When freeing root block of a tree, btrfs_free_extent' parameter 'ref_generation' is from root block itseft. When freeing non-root block, 'ref_generation' is from its parent. so when converting a non-root block to root block, we must guarantee its generation is equal to its parent's generation. Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index cf32651876bf..ef8809c1e69c 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -720,6 +720,9 @@ static int balance_level(struct btrfs_trans_handle *trans, /* promote the child to a root */ child = read_node_slot(root, mid, 0); BUG_ON(!child); + ret = btrfs_cow_block(trans, root, child, mid, 0, &child); + BUG_ON(ret); + root->node = child; path->nodes[level] = NULL; clean_tree_block(trans, root, mid);