diff options
author | Theodore Ts'o <tytso@mit.edu> | 2014-04-28 10:03:12 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-05-04 23:15:49 -0400 |
commit | d51072af0a9c458e12391be0639a129ede1d2931 (patch) | |
tree | 0f7f2d900ac56e68917877764343a88b6cd88560 | |
parent | 45a78b88dba1db5758f68d0d3229d3cb42da6050 (diff) | |
download | e2fsprogs-d51072af0a9c458e12391be0639a129ede1d2931.tar.gz |
libext2fs: fix alloc_allocate_group_table() if the flexbg_offset wraps
If the previous block group's inode table ends at the very end of file
system, wrap around to the beginning of the flex_bg.
This fixes a bug was tickled by:
mke2fs.conf:
frontload = {
features = extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^resize_inode,sparse_super2
hash_alg = half_md4
num_backup_sb = 0
packed_meta_blocks = 1
inode_ratio = 4194304
flex_bg_size = 262144
}
mke2fs -T frontload /tmp/foo.img 2T
resize2fs -M /tmp/foo.img
resize2fs -M /tmp/foo.img
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | lib/ext2fs/alloc_tables.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c index fec9003e..bc99943c 100644 --- a/lib/ext2fs/alloc_tables.c +++ b/lib/ext2fs/alloc_tables.c @@ -54,8 +54,8 @@ static blk64_t flexbg_offset(ext2_filsys fs, dgrp_t group, blk64_t start_blk, * Don't do a long search if the previous block * search is still valid. */ - if (start_blk && ext2fs_test_block_bitmap_range2(bmap, start_blk, - elem_size)) + if (start_blk && start_blk < ext2fs_blocks_count(fs->super) && + ext2fs_test_block_bitmap_range2(bmap, start_blk, elem_size)) return start_blk; start_blk = ext2fs_group_first_block2(fs, flexbg_size * flexbg); |