btrfs-progs: force overwrite should wipe stale SB
authorAnand Jain <anand.jain@oracle.com>
Wed, 1 Oct 2014 23:22:09 +0000 (07:22 +0800)
committerDavid Sterba <dsterba@suse.cz>
Fri, 10 Oct 2014 08:38:31 +0000 (10:38 +0200)
commitd0b24918f6a593969ccbdcf861c142ba2ccc67b7
treef0172d347239646b041cceefeeacc033b70e9c49
parent2c0e02a568c7db99922e9080407f8fc22d1991bd
btrfs-progs: force overwrite should wipe stale SB

(I am unable to reproduce the issue, tried to go back with progs versions
but still the same. So as of now this code remains untested, suggest to
wait till we have a reproducible test case).

Here is a test case which says it all..

mkfs.xfs -f $DEV
mkfs.btrfs -f $DEV
mount $DEV $MNT
mount: /dev/vdiskc: more filesystems detected. This should not happen,
       use -t <type> to explicitly specify the filesystem type or
       use wipefs(8) to clean up the device.

mount: you must specify the filesystem type

with this patch btrfs_prepare_device() also wipes old FS if any,
btrfs_prepare_device() is called after we have verified that
user has provided -f option.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
utils.c