]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
mke2fs: make s_inodes_per_group >= 8 in ext2fs_initialize
authorTao Ma <boyu.mt@taobao.com>
Mon, 9 May 2011 15:38:42 +0000 (23:38 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 15 May 2011 03:26:13 +0000 (23:26 -0400)
commit598d20cc3c0f71561402e13c07aaf5880b85fa37
treedbc9f7be643e1972feafc2dc7b27e8d2f1483c52
parent5fff975431e02c2b746b023d3c5e6755e910eaa9
mke2fs: make s_inodes_per_group >= 8 in ext2fs_initialize

current mkfs.ext4 fails if we tried with the following parameters:

mkfs.ext4  -m 0 -N 16 -O ^has_journal,^resize_inode,^uninit_bg,extent,meta_bg -b 1024 /dev/sdb3

It will cause segfault, but it is caused by another issue.  See my
patch "mke2fs: Avoid segmentation fault in
ext2fs_alloc_generic_bmap". And with that patch, the mkfs.ext4 will
fail with the error: /dev/sdb3: Memory allocation failed while setting
up superblock

The reason is that in ext2fs_initialize, we align s_inodes_per_group
to 8, but fails to consider the case that s_inodes_per_group < 8.
So make at least 8 inodes for s_inodes_per_group.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/initialize.c