linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] btrfs-progs: mkfs free-space-info bug
@ 2024-10-08  0:27 Leo Martins
  2024-10-08  0:27 ` [PATCH v3 1/3] btrfs-progs: remove block group free space Leo Martins
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Leo Martins @ 2024-10-08  0:27 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

Currently mkfs creates a few block-groups to bootstrap the filesystem.
Along with these block-groups some free-space-infos are created. When
the block-group cleanup happens the block-groups are deleted and the
free-space-infos are not. This patch set introduces a fix that deletes
the free-space-infos when the block-groups are deleted.

When implementing a test for my changes I found that there was already
some code in free-space-tree.c that attempts to verify that all
free-space-infos correspond to a block-group. This code only checks if
there exists a block-group that has an objectid >= free-space-info's
objectid. I added an additional check to make sure that the block-group
actually matches the free-space-info's objectid and offset.

Making this change to fsck will cause all filesystems that were created
using mkfs.btrfs to warn that there is some free-space-info that doesn't
correspond to a block-group. I've softened the language and included
instructions on how to fix the issue.

CHANGELOG:
v3:
- Added patch 3/3 to add free-space-info checking in tree-checker.
- Softened the warning in patch 2/3

Leo Martins (3):
  btrfs-progs: delete free space when deleting block group
  btrfs-progs: check free space maps to block group
  btrfs-progs: free-space-info tree-checker

 common/clear-cache.c            | 11 +++++++++--
 kernel-shared/extent-tree.c     | 10 ++++++++++
 kernel-shared/free-space-tree.c |  3 +++
 kernel-shared/tree-checker.c    | 29 +++++++++++++++++++++++++++++
 4 files changed, 51 insertions(+), 2 deletions(-)

-- 
2.43.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-21  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08  0:27 [PATCH v3 0/3] btrfs-progs: mkfs free-space-info bug Leo Martins
2024-10-08  0:27 ` [PATCH v3 1/3] btrfs-progs: remove block group free space Leo Martins
2024-10-08  0:27 ` [PATCH v3 2/3] btrfs-progs: check free space maps to block group Leo Martins
2025-07-21  9:15   ` Mark Harmstone
2024-10-08  0:27 ` [PATCH v3 3/3] btrfs-progs: free-space-info tree-checker Leo Martins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).