Skip to content

trfs-progs: check/lowmem: fix false alerts on squota features#1113

Open
adam900710 wants to merge 4 commits intokdave:develfrom
adam900710:lowmem_simple_quota
Open

trfs-progs: check/lowmem: fix false alerts on squota features#1113
adam900710 wants to merge 4 commits intokdave:develfrom
adam900710:lowmem_simple_quota

Conversation

@adam900710
Copy link
Copy Markdown
Collaborator

The lowmem mode check doesn't recognize the new EXTENT_OWNER_REF key
type, thus it will always treat it as an unknown inline type and cause
false alerts.

Fix it by adding such types to lowmem check.

The first patch is to fix a format string error during the add of inline
backref sequence output, which breaks the indent.

The second patch is the real fix for lowmem btrfs check on squota
feature.

The last one is a new test case for fsck on squota.

Surprisingly the test case fsck/071 contains no image file.

It looks like a merge error, as the patch I sent to the mailing list
correctly shows the binary file:

 https://lore.kernel.org/linux-btrfs/dd3a868f33762d907a1c8bfc99c14b47c917ba7b.1770335913.git.wqu@suse.com/

Anyway, add back the missing binary file, which is created by v6.16
btrfs-progs, which has the orphan fst entries.

Signed-off-by: Qu Wenruo <wqu@suse.com>
There is missing tab for EXTENT_OWNER_REF_KEY, which results output not
following the same indent:

	item 13 key (84082688 EXTENT_ITEM 1048576) itemoff 15763 itemsize 62
		refs 1 gen 14 flags DATA
	(172 0x100) textent owner root 256 <<<
		(178 0xdea30debbf5f519) extent data backref root 256 objectid 258 offset 0 count 1

And it's caused by a misplaced 't':

			printf("\t\(%u 0x%llx) textent owner root %llu\n",

There is no special escape sequence "\(", nor the word "textent", it
looks like the 't' is incorrectly placed by commit ad8a831
("btrfs-progs: dump-tree: output the sequence number for inline
references").

Fix it so that the output is correct now:

	item 13 key (84082688 EXTENT_ITEM 1048576) itemoff 15763 itemsize 62
		refs 1 gen 14 flags DATA
		(172 0x100) textent owner root 256
		(178 0xdea30debbf5f519) extent data backref root 256 objectid 258 offset 0 count 1

Signed-off-by: Qu Wenruo <wqu@suse.com>
[BUG]
When simple quota is enabled, lowmem will give false alerts:

 [3/8] checking extents
 ERROR: extent[13631488 168 1048576] has unknown ref type: 172
 ERROR: extent[63963136 168 131072] has unknown ref type: 172
 ERROR: extent[63963136 168 131072] has unknown ref type: 172
 ERROR: file extent[257 0] root 256 owner 256 backref lost
 ERROR: extent[13631488 168 1048576] has unknown ref type: 172
 ERROR: file extent[258 0] root 256 owner 256 backref lost
 ERROR: errors found in extent allocation tree or chunk allocation

[CAUSE]
Lowmem mode has strict checks on the inlined backref type, and
unfortunately EXTENT_OWNER_REF is not inside the support 4 backre types,
thus it's treated as an unknown type, and caused the false alerts.

[FIX]
Add the EXTENT_OWNER_REF type into the supported types.

For lowmem check itself, those key types are just skipped as it's only
to indicate the owner of a data extent, which will be verified by qgroup
part.

Signed-off-by: Qu Wenruo <wqu@suse.com>
…alerts

The new test script will fill a btrfs with squota enabled:

- A file with regular data extents
- A file with preallocated extents
- Several files with inline extents to bump up the tree level
- Snapshot of a subvolume containing above files

Then run btrfs check to verify no error is found.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant