Btrfs-progs: fsck: avoid overwritting existed space when initting csum tree
commitacdf338c136a602b9006f37efe2c6a60784834c7
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Tue, 25 Feb 2014 11:48:56 +0000 (25 19:48 +0800)
committerChris Mason <clm@fb.com>
Fri, 21 Mar 2014 13:23:24 +0000 (21 06:23 -0700)
tree67c2db1e120aa1ab9a449f3b8f574fe54103fb14
parent9c59fb98094429150a338980fb593c1887b6e25d
Btrfs-progs: fsck: avoid overwritting existed space when initting csum tree

Steps to reproduce:
 # mkfs.btrfs -f /dev/sda9
 # btrfs check /dev/sda9 --init-extent-tree --init-csum-tree
 # btrfs check /dev/sda9

During reinitting extent tree, we will pin all metadata blocks to
avoid overwritting existing metadata space. However, those space will
be unpinned after committing transaction.

If we try to reinit csum tree after reiniting extent tree, we may
overwrite existing space. Fix this problem by making reinit extent tree
and csum tree in same transaction.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
cmds-check.c