Btrfs-progs: Prevent creation of filesystem with 'mixed bgs' and having differing...
authorChandan Rajendra <chandan@linux.vnet.ibm.com>
Wed, 14 Oct 2015 17:40:38 +0000 (23:10 +0530)
committerDavid Sterba <dsterba@suse.com>
Mon, 2 Nov 2015 08:35:08 +0000 (09:35 +0100)
commita73eb8b993dc644f6b10fc18b9036f89e00588e2
tree9c429fbd0f450f084ba7bbb5b7251b9234fbf649
parentca582727e8393aec3f585ab77b66279970af18ed
Btrfs-progs: Prevent creation of filesystem with 'mixed bgs' and having differing sectorsize and nodesize.

mkfs.btrfs allows creation of Btrfs filesystem instances with mixed block
group feature enabled and having a sectorsize different from nodesize.
For e.g:

[root@localhost btrfs-progs]# mkfs.btrfs -f -M -s 4096 -n 16384  /dev/loop0
Forcing mixed metadata/data groups
btrfs-progs v3.19-rc2-404-gbbbd18e-dirty
See http://btrfs.wiki.kernel.org for more information.

Performing full device TRIM (4.00GiB) ...
Label:              (null)
UUID:               c82b5720-6d88-4fa1-ac05-d0d4cb797fd5
Node size:          16384
Sector size:        4096
Filesystem size:    4.00GiB
Block group profiles:
  Data+Metadata:    single            8.00MiB
  System:           single            4.00MiB
SSD detected:       no
Incompat features:  mixed-bg, extref, skinny-metadata
Number of devices:  1
Devices:
  ID        SIZE  PATH
   1     4.00GiB  /dev/loop6

This commit fixes the issue by setting BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS
feature bit before checking the validity of nodesize that was specified on the
command line.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.com>
mkfs.c