From: Theodore Ts'o Date: Thu, 16 Jun 2011 02:11:59 +0000 (-0400) Subject: libext2fs: fix regression in ext2fs_new_block2() for uninit_bg file systems X-Git-Tag: v1.42-WIP-0702~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f2e1a81d24ca2334547edd52690378d6eb763c7;p=thirdparty%2Fe2fsprogs.git libext2fs: fix regression in ext2fs_new_block2() for uninit_bg file systems Commit b0ecb787ef introduced a bug in check_block_uninit(), which is used by ext2fs_new_block2(). This bug resulted in the block bitmap for the block group in question not having space reserved for the file system metadata blocks. Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c index fbecdbe74..d96b2aad1 100644 --- a/lib/ext2fs/alloc.c +++ b/lib/ext2fs/alloc.c @@ -55,6 +55,8 @@ static void check_block_uninit(ext2_filsys fs, ext2fs_block_bitmap map, for (i=0; i < fs->super->s_blocks_per_group; i++, blk++) ext2fs_fast_unmark_block_bitmap2(map, blk); + blk = (group * fs->super->s_blocks_per_group) + + fs->super->s_first_data_block; for (i=0; i < fs->super->s_blocks_per_group; i++, blk++) { if ((blk == super_blk) || (old_desc_blk && old_desc_blocks &&