Messages in this thread |  | | Date | Sun, 12 Apr 2026 06:07:54 +0200 | | From | kernel test robot <> | | Subject | Re: [PATCH v2] btrfs: reject empty non-root tree blocks at read time |
| |
Hi ZhengYuan,
kernel test robot noticed the following build errors:
[auto build test ERROR on kdave/for-next] [also build test ERROR on linus/master v7.0-rc7 next-20260410] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/ZhengYuan-Huang/btrfs-reject-empty-non-root-tree-blocks-at-read-time/20260412-051345 base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next patch link: https://lore.kernel.org/r/20260409081140.3400650-1-gality369%40gmail.com patch subject: [PATCH v2] btrfs: reject empty non-root tree blocks at read time config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260412/202604120628.G64NL6IJ-lkp@intel.com/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260412/202604120628.G64NL6IJ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202604120628.G64NL6IJ-lkp@intel.com/
All errors (new ones prefixed by >>):
>> fs/btrfs/disk-io.c:431:9: error: use of undeclared label 'out' 431 | goto out; | ^ 1 error generated.
vim +/out +431 fs/btrfs/disk-io.c
355 356 /* Do basic extent buffer checks at read time */ 357 int btrfs_validate_extent_buffer(struct extent_buffer *eb, 358 const struct btrfs_tree_parent_check *check) 359 { 360 struct btrfs_fs_info *fs_info = eb->fs_info; 361 u64 found_start; 362 const u32 csum_size = fs_info->csum_size; 363 u8 found_level; 364 u8 result[BTRFS_CSUM_SIZE]; 365 const u8 *header_csum; 366 int ret = 0; 367 const bool ignore_csum = btrfs_test_opt(fs_info, IGNOREMETACSUMS); 368 369 ASSERT(check); 370 371 found_start = btrfs_header_bytenr(eb); 372 if (unlikely(found_start != eb->start)) { 373 btrfs_err_rl(fs_info, 374 "bad tree block start, mirror %u want %llu have %llu", 375 eb->read_mirror, eb->start, found_start); 376 return -EIO; 377 } 378 if (unlikely(check_tree_block_fsid(eb))) { 379 btrfs_err_rl(fs_info, "bad fsid on logical %llu mirror %u", 380 eb->start, eb->read_mirror); 381 return -EIO; 382 } 383 found_level = btrfs_header_level(eb); 384 if (unlikely(found_level >= BTRFS_MAX_LEVEL)) { 385 btrfs_err(fs_info, 386 "bad tree block level, mirror %u level %d on logical %llu", 387 eb->read_mirror, btrfs_header_level(eb), eb->start); 388 return -EIO; 389 } 390 391 csum_tree_block(eb, result); 392 header_csum = folio_address(eb->folios[0]) + 393 get_eb_offset_in_folio(eb, offsetof(struct btrfs_header, csum)); 394 395 if (memcmp(result, header_csum, csum_size) != 0) { 396 btrfs_warn_rl(fs_info, 397 "checksum verify failed on logical %llu mirror %u wanted " BTRFS_CSUM_FMT " found " BTRFS_CSUM_FMT " level %d%s", 398 eb->start, eb->read_mirror, 399 BTRFS_CSUM_FMT_VALUE(csum_size, header_csum), 400 BTRFS_CSUM_FMT_VALUE(csum_size, result), 401 btrfs_header_level(eb), 402 ignore_csum ? ", ignored" : ""); 403 if (unlikely(!ignore_csum)) 404 return -EUCLEAN; 405 } 406 407 if (unlikely(found_level != check->level)) { 408 btrfs_err(fs_info, 409 "level verify failed on logical %llu mirror %u wanted %u found %u", 410 eb->start, eb->read_mirror, check->level, found_level); 411 return -EIO; 412 } 413 if (unlikely(check->transid && 414 btrfs_header_generation(eb) != check->transid)) { 415 btrfs_err_rl(eb->fs_info, 416 "parent transid verify failed on logical %llu mirror %u wanted %llu found %llu", 417 eb->start, eb->read_mirror, check->transid, 418 btrfs_header_generation(eb)); 419 return -EIO; 420 } 421 if (check->has_first_key) { 422 const struct btrfs_key *expect_key = &check->first_key; 423 struct btrfs_key found_key; 424 425 /* We have @first_key, so this @eb must have at least one item. */ 426 if (unlikely(btrfs_header_nritems(eb) == 0)) { 427 btrfs_err(fs_info, 428 "invalid tree nritems, bytenr=%llu nritems=0 expect >0", 429 eb->start); 430 ret = -EUCLEAN; > 431 goto out; 432 } 433 434 if (found_level) 435 btrfs_node_key_to_cpu(eb, &found_key, 0); 436 else 437 btrfs_item_key_to_cpu(eb, &found_key, 0); 438 if (unlikely(btrfs_comp_cpu_keys(expect_key, &found_key))) { 439 btrfs_err(fs_info, 440 "tree first key mismatch detected, bytenr=%llu parent_transid=%llu key expected=(%llu,%u,%llu) has=(%llu,%u,%llu)", 441 eb->start, check->transid, 442 expect_key->objectid, 443 expect_key->type, expect_key->offset, 444 found_key.objectid, found_key.type, 445 found_key.offset); 446 return -EUCLEAN; 447 } 448 } 449 if (check->owner_root) { 450 ret = btrfs_check_eb_owner(eb, check->owner_root); 451 if (ret < 0) 452 return ret; 453 } 454 455 /* If this is a leaf block and it is corrupt, just return -EIO. */ 456 if (found_level == 0 && btrfs_check_leaf(eb)) 457 ret = -EIO; 458 459 if (found_level > 0 && btrfs_check_node(eb)) 460 ret = -EIO; 461 462 if (ret) 463 btrfs_err(fs_info, 464 "read time tree block corruption detected on logical %llu mirror %u", 465 eb->start, eb->read_mirror); 466 return ret; 467 } 468
-- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
|  |