diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-01-19 08:43:36 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-01-19 08:43:36 -0500 |
commit | c58a08e673a10d0e5fa4855ca58ab2cbf48fd029 (patch) | |
tree | 84ca6dcf98d45dee1d2131d0caeaea57f1e42fc4 | |
parent | 98446d738201df0dd24830eaf0781c7b4a26689a (diff) | |
download | e2fsprogs-c58a08e673a10d0e5fa4855ca58ab2cbf48fd029.tar.gz |
resize2fs: Move all required blocks for ext4 filesystems
In the function blocks_to_move(), when checking to see if a block
group's block bitmap is initialized, we need to check the old_fs's
block group descriptors, not the new file system's (already truncated)
group descriptor data structures. Otherwise we will end up
derferencing past the end of the array boundary, and the resulting
garbage value may indicate that the bitmap is uninitialized, and so
all of the blocks in that block group will be skipped, resulting in
some blocks not getting marked as needing relocation.
This showed up in the following test case:
mke2fs -t ext4 -b 1024 test.img 1048576
resize2fs test.img 80000
The journal inode after the resize operation looked like this:
debugfs: stat <8>
Inode: 8 Type: regular Mode: 0600 Flags: 0x80000
...
BLOCKS:
(IND):35385, (0-5836):2356-8192, (5837-21959):8454-24576, (21960-32506):24838-35
384, (32507-32767):434177-434437
TOTAL: 32769
The blocks 434177-434437 were not moved because block group 53 was
wrongly thought to have an unitialized block group.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | resize/resize2fs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/resize/resize2fs.c b/resize/resize2fs.c index abe05f57..e7a08daa 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -745,7 +745,7 @@ static errcode_t blocks_to_move(ext2_resize_t rfs) g = ext2fs_group_of_blk(fs, blk); if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super, EXT4_FEATURE_RO_COMPAT_GDT_CSUM) && - (fs->group_desc[g].bg_flags & EXT2_BG_BLOCK_UNINIT)) { + (old_fs->group_desc[g].bg_flags & EXT2_BG_BLOCK_UNINIT)) { /* * The block bitmap is uninitialized, so skip * to the next block group. |