On Thu, Feb 13, 2020 at 11:15:57AM +0100, Jan Kara wrote: > E2fsck directory rehashing code can fail with ENOSPC due to a bug in > ext2fs_htree_intnode_maxrecs() which fails to take metadata checksum > into account and thus e.g. e2fsck can decide to create 1 indirect level > of index tree when two are actually needed. Fix the logic to account for > metadata checksum. > > Signed-off-by: Jan Kara <jack@xxxxxxx> Applied with a minor change; I didn't want to make this change: > -_INLINE_ int ext2fs_htree_intnode_maxrecs(ext2_filsys fs, int blocks) > +static inline int ext2fs_htree_intnode_maxrecs(ext2_filsys fs, int blocks) ... because it would make ext2fs_htree_intmode_maxrecs disappear from libext2fs.so. So I changed this: > + if (ext2fs_has_feature_metadata_csum(fs->super)) to this: + if ((EXT2_SB(fs->super)->s_feature_ro_compat & + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) != 0) to fix the inline related compilation errors. - Ted