Skip to contentSkip to conversation

regression - ext4 fails to mount a filesystem due to large orphan file

DISCUSSION Mikulas Patocka 2 participants 2 messages Sep 29 – Oct 2

lore
Share & tools
lore
#0 lore raw

Hi

I report a bug in the commit 7c11c56eb32eae96893eebafdbe3decadefe88ad. The commit introduces a regression into the ext4 filesystem:

# truncate -s 1GiB ext4.test
# mkfs.ext4 -b 1024 ext4.test
mke2fs 1.47.4 (6-Mar-2025)
Discarding device blocks: done
Creating filesystem with 1048576 1k blocks and 65536 inodes
Filesystem UUID: 246857e4-85e8-4393-b3c7-d52a92b999e9
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553,
        1024001

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

# mount -o loop ext4.test /mnt/test
mount: /mnt/test: volání fsconfig() selhalo: Struktura potřebuje opravu.
       dmesg(1) může obsahovat více údajů o selhaném připojení.
# dmesg |tail
[ 2325.547222] EXT4-fs (loop0): mounted filesystem 3af6fb51-f5c5-44af-84f1-d94e098f66d0 r/w with ordered data mode. Quota mode: none.
[ 2325.549968] EXT4-fs (loop0): unmounting filesystem 3af6fb51-f5c5-44af-84f1-d94e098f66d0.
[ 2325.585469] loop0: detected capacity change from 0 to 134217728
[ 2325.589344] EXT4-fs (loop0): mounted filesystem f6d86dae-c171-45ea-9e52-7d0de64d449c r/w with ordered data mode. Quota mode: none.
[ 2325.592672] EXT4-fs (loop0): unmounting filesystem f6d86dae-c171-45ea-9e52-7d0de64d449c.
[ 2374.988529] EXT4-fs (dm-0): unmounting filesystem 794eeb51-98fb-4d5c-b511-e4a56817ee6c.
[ 2376.433633] brd: module unloaded
[ 2906.044816] loop0: detected capacity change from 0 to 2097152
[ 2906.052278] EXT4-fs (loop0): orphan file too big: 1048576
[ 2906.052388] EXT4-fs (loop0): mount failed
# mkfs.ext4 -V
mke2fs 1.47.4 (6-Mar-2025)
        Using EXT2FS Library version 1.47.4

(the limit 512 blocks seems to be enforced in mke2fs in git, but distributions still use the last released version 1.47.4, which can produce filesystems with larger orphan list)

Mikulas

#1 lore raw

Hi!

Quoted 2 lines · Mikulas Patocka

I report a bug in the commit 7c11c56eb32eae96893eebafdbe3decadefe88ad. The commit introduces a regression into the ext4 filesystem:

Thanks for report!

Quoted 33 lines
# truncate -s 1GiB ext4.test
# mkfs.ext4 -b 1024 ext4.test
mke2fs 1.47.4 (6-Mar-2025)
Discarding device blocks: done
Creating filesystem with 1048576 1k blocks and 65536 inodes
Filesystem UUID: 246857e4-85e8-4393-b3c7-d52a92b999e9
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553,
        1024001

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

# mount -o loop ext4.test /mnt/test
mount: /mnt/test: volání fsconfig() selhalo: Struktura potřebuje opravu.
       dmesg(1) může obsahovat více údajů o selhaném připojení.
# dmesg |tail
[ 2325.547222] EXT4-fs (loop0): mounted filesystem 3af6fb51-f5c5-44af-84f1-d94e098f66d0 r/w with ordered data mode. Quota mode: none.
[ 2325.549968] EXT4-fs (loop0): unmounting filesystem 3af6fb51-f5c5-44af-84f1-d94e098f66d0.
[ 2325.585469] loop0: detected capacity change from 0 to 134217728
[ 2325.589344] EXT4-fs (loop0): mounted filesystem f6d86dae-c171-45ea-9e52-7d0de64d449c r/w with ordered data mode. Quota mode: none.
[ 2325.592672] EXT4-fs (loop0): unmounting filesystem f6d86dae-c171-45ea-9e52-7d0de64d449c.
[ 2374.988529] EXT4-fs (dm-0): unmounting filesystem 794eeb51-98fb-4d5c-b511-e4a56817ee6c.
[ 2376.433633] brd: module unloaded
[ 2906.044816] loop0: detected capacity change from 0 to 2097152
[ 2906.052278] EXT4-fs (loop0): orphan file too big: 1048576
[ 2906.052388] EXT4-fs (loop0): mount failed
# mkfs.ext4 -V
mke2fs 1.47.4 (6-Mar-2025)
        Using EXT2FS Library version 1.47.4
Quoted 3 lines

(the limit 512 blocks seems to be enforced in mke2fs in git, but distributions still use the last released version 1.47.4, which can produce filesystems with larger orphan list)

Well, we could produce larger orphan files since the beginning (in the past you could specify arbitrary number of blocks as a parameter) but what you show is that a released e2fsprogs version will produce such filesystems *by default* and that's indeed a bigger issue. I'll send a fix for the kernel. Thanks again!

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR