btrfs-progs: avoid implicit scan for backup SB
authorAnand Jain <Anand.Jain@oracle.com>
Mon, 17 Mar 2014 11:59:01 +0000 (19:59 +0800)
committerChris Mason <clm@fb.com>
Sat, 5 Apr 2014 00:54:35 +0000 (17:54 -0700)
commita062ffd74de0b6ad74ea2c9750da94e2964856a1
tree6ad555771e5975b744f32afc02726a296107d835
parentbf357ff320f80eb1a47e0fd4d06be374e2f2b3fd
btrfs-progs: avoid implicit scan for backup SB

When a disk containing btrfs is overwritten with other FS, ext4
for example it doesn't overwrite 2nd and 3rd copy of the btrfs SB.
And btrfs_read_dev_super() would look for backup SB when primary
SB isn't found. This causes the problem as in the reproducer below.

In kernel we avoid this by _not_ reading backup SB implicitly,
this patch would port the same to btrfs-progs.

reproducer:
mkfs.btrfs /dev/sde
mkfs.ext4 /dev/sde
mount /dev/sde /ext4
btrfs-convert /dev/sde (is successful (bug))

with this patch
::
btrfs-convert /dev/sde
/dev/sde is mounted

Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
disk-io.c