Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-20926

e2fsprogs: resize2fs sparse_super2/block map and mke2fs packed_meta_blocks bugs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • 3
    • 9223372036854775807

      [Claude] Two resize2fs bugs found while prototyping metadata migration for LU-20924. Both are in upstream e2fsprogs as well as the Lustre branch, and are independent of hybrid/IOPS support.

      sparse_super2 grow frees an in-use block

      When a sparse_super2 filesystem is grown, the backup superblock and group descriptors move from the old last group to the new last group, and clear_sparse_super2_last_group() frees the old copy. It frees one block too many after the descriptors, because the count returned by ext2fs_super_and_bgd_loc2() includes the superblock. If that block is in use, it can later be allocated a second time.

      It also does not mark the block bitmap dirty, so if the bitmaps were already written by move_itables() the old backup is never freed and the group free block count no longer matches the bitmap.

      Fix: free only the backup blocks and mark the bitmap dirty. Fixes: 65c6c3e06f72 ("Add support for new compat feature "sparse_super2""). New regression test r_sparse_super2_grow.

      block map sort breaks on filesystems over 8TiB

      extent_cmp() in resize/extent.c returns the difference of two __u64 block numbers as an int, so blocks 2^31 or more apart (filesystems over 8TiB with 4KiB blocks) sort in the wrong order once the map is unsorted, and ext2fs_extent_translate() then misses entries. This dates back to the original resize2fs, but resize2fs adds blocks in order, so the sort is not normally used.

      Fix: compare the block numbers instead of subtracting them. New test_extent case.

      Both fixes are to be submitted to linux-ext4 as well as tools/e2fsprogs.

      mke2fs packed_meta_blocks with one group per flex group

      mke2fs -t ext4 -b 4096 -g 8192 -G 1 -O sparse_super2,flex_bg,^resize_inode -E packed_meta_blocks=1,num_backup_sb=1 on a 128MiB image creates an inconsistent filesystem: e2fsck reports group free block counts off by 66 blocks per group, and the kernel returns EIO/ENOSPC on mkdir. It does not need -E iops; -G 2 is clean. Fix and regression test to follow with the two resize2fs fixes.

            wc-triage WC Triage
            adilger Andreas Dilger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: