btrfs-progs: check: recognize verity item keys in original mode
PATCH 1/1 btrfs-progs: check: recognize verity item keys in original mode
Commit 4e88bb6e ("btrfs-progs: enhance detection on unknown inode keys") added stricter validation for inode keys in the original mode checker, flagging unknown key types as errors. However, it did not add cases for BTRFS_VERITY_DESC_ITEM_KEY (36) and BTRFS_VERITY_MERKLE_ITEM_KEY (37), causing any filesystem with fs-verity enabled files to fail the check with:
ERROR: unknown key (257 36 0) found in leaf 30621696
Add the missing switch cases so that verity metadata items are recognized and silently skipped during the check, matching the behavior of lowmem mode which already handles them.
--- check/main.c | 3 +++ 1 file changed, 3 insertions(+)
check/main.c +3 -0
@@ -1895,6 +1895,9 @@ static int process_one_leaf(struct btrfs_root *root, struct extent_buffer *eb,case BTRFS_XATTR_ITEM_KEY : ret =process_xattr_item (eb, i, &key, active_node);break ; +case BTRFS_VERITY_DESC_ITEM_KEY : +case BTRFS_VERITY_MERKLE_ITEM_KEY : +break ;default :error ("unknown key (%llu %u %llu) found in leaf %llu" , key.objectid, key.type, key.offset, eb->start);
Signature · 1 line
2.52.0
Quoted 7 lines · Leo Martins
Commit
4e88bb6e("btrfs-progs: enhance detection on unknown inode keys") added stricter validation for inode keys in the original mode checker, flagging unknown key types as errors. However, it did not add cases forBTRFS_VERITY_DESC_ITEM_KEY(36) andBTRFS_VERITY_MERKLE_ITEM_KEY(37), causing any filesystem with fs-verity enabled files to fail the check with:
Quoted 7 lines
ERROR: unknown key (257 36 0) found in leaf 30621696
Add the missing switch cases so that verity metadata items are recognized and silently skipped during the check, matching the behavior of lowmem mode which already handles them.
Signed-off-by Leo Martins <[email protected]>
And I'll merge the PR in github.
Thanks for spotting this,
Qu
Quoted 18 lines
--- check/main.c | 3 +++ 1 file changed, 3 insertions(+)check/main.c +3
-0@@ -1895,6 +1895,9 @@ static int process_one_leaf(struct btrfs_root *root, struct extent_buffer *eb,case BTRFS_XATTR_ITEM_KEY : ret =process_xattr_item (eb, i, &key, active_node);break ; +case BTRFS_VERITY_DESC_ITEM_KEY : +case BTRFS_VERITY_MERKLE_ITEM_KEY : +break ;default :error ("unknown key (%llu %u %llu) found in leaf %llu" , key.objectid, key.type, key.offset, eb->start);
Quoted 7 lines · Leo Martins
Commit
4e88bb6e("btrfs-progs: enhance detection on unknown inode keys") added stricter validation for inode keys in the original mode checker, flagging unknown key types as errors. However, it did not add cases forBTRFS_VERITY_DESC_ITEM_KEY(36) andBTRFS_VERITY_MERKLE_ITEM_KEY(37), causing any filesystem with fs-verity enabled files to fail the check with:
Quoted 5 lines
ERROR: unknown key (257 36 0) found in leaf 30621696
Add the missing switch cases so that verity metadata items are recognized and silently skipped during the check, matching the behavior of lowmem mode which already handles them.
Unfortunately I noticed that, lowmem mode doesn't have such handling either.
As I created a test case with verity items, and CI failed due to false alerts from CI.
I'll send out a small fix for the lowmem mode, along with the test case.
Thanks,
Qu
Quoted 20 lines
Signed-off-by Leo Martins <[email protected]>--- check/main.c | 3 +++ 1 file changed, 3 insertions(+)check/main.c +3
-0@@ -1895,6 +1895,9 @@ static int process_one_leaf(struct btrfs_root *root, struct extent_buffer *eb,case BTRFS_XATTR_ITEM_KEY : ret =process_xattr_item (eb, i, &key, active_node);break ; +case BTRFS_VERITY_DESC_ITEM_KEY : +case BTRFS_VERITY_MERKLE_ITEM_KEY : +break ;default :error ("unknown key (%llu %u %llu) found in leaf %llu" , key.objectid, key.type, key.offset, eb->start);
Quoted 18 lines · On Wed, 25 Mar 2026 09:19:00 +1030 Qu Wenruo <[email protected]> wrote:
Quoted 7 lines · Leo Martins
Commit
4e88bb6e("btrfs-progs: enhance detection on unknown inode keys") added stricter validation for inode keys in the original mode checker, flagging unknown key types as errors. However, it did not add cases forBTRFS_VERITY_DESC_ITEM_KEY(36) andBTRFS_VERITY_MERKLE_ITEM_KEY(37), causing any filesystem with fs-verity enabled files to fail the check with:Quoted 5 lines
ERROR: unknown key (257 36 0) found in leaf 30621696
Add the missing switch cases so that verity metadata items are recognized and silently skipped during the check, matching the behavior of lowmem mode which already handles them.
Unfortunately I noticed that, lowmem mode doesn't have such handling either.
Quoted 7 lines
As I created a test case with verity items, and CI failed due to false alerts from CI.
I'll send out a small fix for the lowmem mode, along with the test case.
Thanks,
Qu
Good catch, not sure how I missed that, thanks!
Quoted 21 lines
Quoted 21 lines
Signed-off-by Leo Martins <[email protected]>--- check/main.c | 3 +++ 1 file changed, 3 insertions(+)check/main.c +3
-0@@ -1895,6 +1895,9 @@ static int process_one_leaf(struct btrfs_root *root, struct extent_buffer *eb,case BTRFS_XATTR_ITEM_KEY : ret =process_xattr_item (eb, i, &key, active_node);break ; +case BTRFS_VERITY_DESC_ITEM_KEY : +case BTRFS_VERITY_MERKLE_ITEM_KEY : +break ;default :error ("unknown key (%llu %u %llu) found in leaf %llu" , key.objectid, key.type, key.offset, eb->start);
Quoted 7 lines · Leo Martins
Commit
4e88bb6e("btrfs-progs: enhance detection on unknown inode keys") added stricter validation for inode keys in the original mode checker, flagging unknown key types as errors. However, it did not add cases forBTRFS_VERITY_DESC_ITEM_KEY(36) andBTRFS_VERITY_MERKLE_ITEM_KEY(37), causing any filesystem with fs-verity enabled files to fail the check with:
Quoted 5 lines
ERROR: unknown key (257 36 0) found in leaf 30621696
Add the missing switch cases so that verity metadata items are recognized and silently skipped during the check, matching the behavior of lowmem mode which already handles them.
Unfortunately I noticed that, lowmem mode doesn't have such handling either.
As I created a test case with verity items, and CI failed due to false alerts from CI.
I'll send out a small fix for the lowmem mode, along with the test case.
Thanks,
Qu
Quoted 20 lines
Signed-off-by Leo Martins <[email protected]>--- check/main.c | 3 +++ 1 file changed, 3 insertions(+)check/main.c +3
-0@@ -1895,6 +1895,9 @@ static int process_one_leaf(struct btrfs_root *root, struct extent_buffer *eb,case BTRFS_XATTR_ITEM_KEY : ret =process_xattr_item (eb, i, &key, active_node);break ; +case BTRFS_VERITY_DESC_ITEM_KEY : +case BTRFS_VERITY_MERKLE_ITEM_KEY : +break ;default :error ("unknown key (%llu %u %llu) found in leaf %llu" , key.objectid, key.type, key.offset, eb->start);