summaryrefslogtreecommitdiff
path: root/btrfs-convert.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2013-11-28 00:08:24 +0800
committerChris Mason <clm@fb.com>2014-01-31 08:22:06 -0800
commit53ee1bccf99cd5b474fe1aa857b7dd176e3a1407 (patch)
tree3e845eed39203782f13c428e09686d30b10070cf /btrfs-convert.c
parente5f72de944385aec1863842f46dd0286801b7faa (diff)
Btrfs-progs: fix the mismatch of extent buffer's space
Now we set @refs to 2 on creating a new extent buffer, meanwhile we allocate the needed free space, but we don't give enough free_extent_buffer() to reduce the eb's references to zero so that the eb can finally be freed, so the problem is we has decrease the referene count of backrefs to zero, which ends up releasing the space occupied by the eb, and this space can be allocated again for something else(another eb or disk), usually a crash(core dump) will occur, I've hit a crash in rb_insert() because another eb re-use the space while the original one is floating around. We should do the same thing as the kernel code does, it's necessary to initialize @refs to 1 instead of 2, this helps us get rid of the above problem. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'btrfs-convert.c')
-rw-r--r--btrfs-convert.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/btrfs-convert.c b/btrfs-convert.c
index ae10eed0..cb6ddd05 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -1634,6 +1634,7 @@ static int init_btrfs(struct btrfs_root *root)
ret = create_subvol(trans, root, BTRFS_DATA_RELOC_TREE_OBJECTID);
BUG_ON(ret);
+ extent_buffer_get(fs_info->csum_root->node);
ret = __btrfs_cow_block(trans, fs_info->csum_root,
fs_info->csum_root->node, NULL, 0, &tmp, 0, 0);
BUG_ON(ret);