btrfs-progs/mkfs
Filipe Manana df090f6eb7 Btrfs-progs: mkfs, fix metadata corruption when using mixed mode
When creating a filesystem with mixed block groups, we are creating two
space info objects to track used/reserved/pinned space, one only for data
and another one only for metadata.

This is making fstests test case generic/416 fail, with btrfs' check
reporting over an hundred errors about bad extents:

  (...)
  bad extent [17186816, 17190912), type mismatch with chunk
  bad extent [17195008, 17199104), type mismatch with chunk
  bad extent [17203200, 17207296), type mismatch with chunk
  (...)

Because, surprisingly, this results in block groups that do not have the
BTRFS_BLOCK_GROUP_DATA flag set but have data extents allocated in them.
This is a regression introduced in btrfs-progs v5.2.

So fix this by making sure we only create one space info object, for both
metadata and data, when mixed block groups are enabled.

Fixes: c31edf610c ("btrfs-progs: Fix false ENOSPC alert by tracking used space correctly")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-26 17:46:43 +02:00
..
Makefile btrfs-progs: build: add stub makefile to image and mkfs 2019-07-04 15:36:01 +02:00
common.c btrfs-progs: utils: split device handling functions to own file 2019-07-04 02:06:34 +02:00
common.h btrfs-progs: mkfs: Fix typos in strings and comments 2018-06-07 16:37:40 +02:00
main.c Btrfs-progs: mkfs, fix metadata corruption when using mixed mode 2019-07-26 17:46:43 +02:00
rootdir.c btrfs-progs: move utils.[ch] to common/ 2019-07-03 20:49:04 +02:00
rootdir.h btrfs-progs: mkfs/rootdir: Fix memory leak in traverse_directory() 2018-02-14 16:31:19 +01:00