Whamcloud - gitweb
libext2fs: fix uninit block calculation when inodes_per_block < first_ino
authorTheodore Ts'o <tytso@mit.edu>
Sun, 29 Jul 2012 17:34:01 +0000 (13:34 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 29 Jul 2012 17:34:01 +0000 (13:34 -0400)
commit3aa8f60aaedd2e467cae690274c70c3d9835802b
tree5f65de0e6f340c76287cce14e6c9fe609504b6da
parent32d4eb2b04f62e5380d29089040af2f8ba7b066e
libext2fs: fix uninit block calculation when inodes_per_block < first_ino

The following commands:

dd if=/dev/zero of=/tmp/foo count=1 ibs=$(( 256 * 1024 * 1024 ))
mke2fs -N 256 -t ext4 /tmp/foo

... will cause mke2fs to write until it fills the device.  The cause
for this is that the explicit request for 256 inodes causes the number
of inodes per block group to be 8.  The ext2fs_initialize() function
assumed that all of the reserved inodes would be in the first block
group, which is not true in this case.  This caused the number of
uninitialized inodes in the first block group to be negative, which
then resulted in mke2fs trying to zero out a very large number of
blocks.  Oops.

Addresses-Sourceforge-Bug: #3528892

Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/initialize.c