Whamcloud - gitweb
resize2fs: don't play stupid games with the block count
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 15 Dec 2014 03:13:09 +0000 (22:13 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 15 Dec 2014 03:13:09 +0000 (22:13 -0500)
commit538ef363261b4f851ca69f342336aa896e24eb27
treed424a662fe6897b8dd867300e72f45a8e3957293
parent1862ef72002603f6bed9df68e0b9e577dd6370ca
resize2fs: don't play stupid games with the block count

While it may be true that playing games with old_fs' block count
during a grow operation shuts up a bunch of warnings, resize2fs
doesn't actually expand the group descriptor array to match the size
we're artificially stuffing into old_fs, which means that if we
actually need to allocate a block out of the larger fs (i.e. we're in
desperation mode), ext2fs_block_alloc_stats2() scribbles on the heap,
leading to crashes if you're lucky and FS corruption if not.

So, rip that piece out and turn off com_err warnings properly and add
a test case to deal with growing a nearly full filesystem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
resize/resize2fs.c
tests/r_expand_full/expect [new file with mode: 0644]
tests/r_expand_full/name [new file with mode: 0644]
tests/r_expand_full/script [new file with mode: 0644]