1. 09 9月, 2019 2 次提交
  2. 01 7月, 2019 1 次提交
    • Q
      btrfs: tree-checker: Check if the file extent end overflows · 4c094c33
      Qu Wenruo 提交于
      Under certain conditions, we could have strange file extent item in log
      tree like:
      
        item 18 key (69599 108 397312) itemoff 15208 itemsize 53
      	extent data disk bytenr 0 nr 0
      	extent data offset 0 nr 18446744073709547520 ram 18446744073709547520
      
      The num_bytes + ram_bytes overflow 64 bit type.
      
      For num_bytes part, we can detect such overflow along with file offset
      (key->offset), as file_offset + num_bytes should never go beyond u64.
      
      For ram_bytes part, it's about the decompressed size of the extent, not
      directly related to the size.
      In theory it is OK to have a large value, and put extra limitation
      on RAM bytes may cause unexpected false alerts.
      
      So in tree-checker, we only check if the file offset and num bytes
      overflow.
      Signed-off-by: NQu Wenruo <wqu@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      4c094c33
  3. 16 5月, 2019 1 次提交
  4. 30 4月, 2019 28 次提交
  5. 17 12月, 2018 1 次提交
  6. 04 12月, 2018 1 次提交
    • Q
      btrfs: tree-checker: Don't check max block group size as current max chunk size limit is unreliable · 10950929
      Qu Wenruo 提交于
      [BUG]
      A completely valid btrfs will refuse to mount, with error message like:
        BTRFS critical (device sdb2): corrupt leaf: root=2 block=239681536 slot=172 \
          bg_start=12018974720 bg_len=10888413184, invalid block group size, \
          have 10888413184 expect (0, 10737418240]
      
      This has been reported several times as the 4.19 kernel is now being
      used. The filesystem refuses to mount, but is otherwise ok and booting
      4.18 is a workaround.
      
      Btrfs check returns no error, and all kernels used on this fs is later
      than 2011, which should all have the 10G size limit commit.
      
      [CAUSE]
      For a 12 devices btrfs, we could allocate a chunk larger than 10G due to
      stripe stripe bump up.
      
      __btrfs_alloc_chunk()
      |- max_stripe_size = 1G
      |- max_chunk_size = 10G
      |- data_stripe = 11
      |- if (1G * 11 > 10G) {
             stripe_size = 976128930;
             stripe_size = round_up(976128930, SZ_16M) = 989855744
      
      However the final stripe_size (989855744) * 11 = 10888413184, which is
      still larger than 10G.
      
      [FIX]
      For the comprehensive check, we need to do the full check at chunk read
      time, and rely on bg <-> chunk mapping to do the check.
      
      We could just skip the length check for now.
      
      Fixes: fce466ea ("btrfs: tree-checker: Verify block_group_item")
      Cc: stable@vger.kernel.org # v4.19+
      Reported-by: NWang Yugui <wangyugui@e16-tech.com>
      Signed-off-by: NQu Wenruo <wqu@suse.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      10950929
  7. 06 11月, 2018 1 次提交
  8. 15 10月, 2018 1 次提交
  9. 06 8月, 2018 2 次提交
  10. 12 4月, 2018 1 次提交
  11. 26 3月, 2018 1 次提交
    • D
      btrfs: add more __cold annotations · e67c718b
      David Sterba 提交于
      The __cold functions are placed to a special section, as they're
      expected to be called rarely. This could help i-cache prefetches or help
      compiler to decide which branches are more/less likely to be taken
      without any other annotations needed.
      
      Though we can't add more __exit annotations, it's still possible to add
      __cold (that's also added with __exit). That way the following function
      categories are tagged:
      
      - printf wrappers, error messages
      - exit helpers
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      e67c718b