1.7 KiB
Test Case: Large Directory Block Index Width
Test ID: TC153-large-directory-block-index Category: Directory Corruption Priority: Critical Latest Result: PASS on exact 9ae22009f FreeBSD 15 KLD; see the G3 report.
Objective
Verify a valid extended FLAT_PLAIN/Layout0 directory with final block index 2147483648 enters the 64-bit lookup path and consistently reports sparse midpoint corruption as EINTEGRITY.
Procedure
Record final/tc153-sparse-evidence.txt and the sparse-prefix hash. Copy the 90112-byte prefix, extend the copy sparsely to 8796093091840 bytes, and verify the prefix hash remains unchanged:
cp large-dir-intmax-sparse-prefix.erofs TC153-provider.erofs
truncate -s 8796093091840 TC153-provider.erofs
stat -f 'provider_size=%z allocated_sectors=%b' TC153-provider.erofs
unit=$(mdconfig -a -t vnode -f TC153-provider.erofs)
diskinfo "/dev/$unit"
mount -t erofs -o ro "/dev/$unit" /tmp/repo22-g3/mnt
./g3_vfs_probe stat /tmp/repo22-g3/mnt/huge
./g3_vfs_probe expect-error stat \
/tmp/repo22-g3/mnt/huge/missing 97
./g3_vfs_probe expect-error stat \
/tmp/repo22-g3/mnt/huge/missing 97
./readdir_probe /tmp/repo22-g3/mnt 128
./g3_vfs_probe expect-error stat \
/tmp/repo22-g3/mnt/huge/missing 97
Unmount, detach, and remove the sparse copy.
Expected Results
GEOM reports 8796093091840 bytes while host allocation remains sparse. The /huge inode reports size 8796093026304 and Layout0 qualification records directory_blocks=2147483649, last_block=2147483648. Both cold lookups and the post-root-readdir lookup return errno 97, with no ENOENT cache masking, wrap, hang, trap, or panic. Record prefix/KLD hashes and complete cleanup.