btrfs-progs: don't remove BTRFS_BLOCK_GROUP_DUP in chunk type
commit57a898dc50c870b4cfe091bdc961403447696558
authorRakesh Pandit <rakesh@tuxera.com>
Thu, 20 Feb 2014 14:44:30 +0000 (20 16:44 +0200)
committerChris Mason <clm@fb.com>
Fri, 21 Mar 2014 13:23:23 +0000 (21 06:23 -0700)
tree5508b1591f93ae7e22bfd53a81aa022b6891269a
parent4701f523907753a54270a657d40f16f06b3c23c4
btrfs-progs: don't remove BTRFS_BLOCK_GROUP_DUP in chunk type

During restoring of image (-r using btrfs-image) we zero out RAID
profile in chunk type but forget to save BTRFS_BLOCK_GROUP_DUP if
present. This results in some false messages being printed by btrfsck.

$  ./mkfs.btrfs /dev/sdb2 -f
$  ./btrfs-image /dev/sdb2 btrfs_image_output
$  ./btrfs-image -r btrfs_image_output disk-image
$  ./btrfsck disk-image
Checking filesystem on disk-image
UUID: e644be2d-7701-4bd4-8804-7487f560d2a7
checking extents
Chunk[256, 228, 20971520]: length(8388608), offset(20971520), type(2) mismatch with block group[20971520, 192, 8388608]: offset(8388608), objectid(20971520), flags(34)
Chunk[256, 228, 29360128]: length(1073741824), offset(29360128), type(4) mismatch with block group[29360128, 192, 1073741824]: offset(1073741824), objectid(29360128), flags(36)
Block group[209715208388608] (flags = 34) didn't find the relative chunk.
Block group[293601281073741824] (flags = 36) didn't find the relative chunk.

Even though ./btrfsck on /dev/sdb2 seemed fine. This is due to type
mismatch above and type mismatch occured because we zero'ed out
BTRFS_BLOCK_GROUP_DUP while handling chunk trees.

Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
btrfs-image.c