diff options
author | Theodore Ts'o <tytso@mit.edu> | 2014-02-15 22:42:25 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-06 21:30:00 -0800 |
commit | d6b55805ac4ffbcd63bf74ce572cc7a94f15be9e (patch) | |
tree | cfc19c7fb27a9dafaa18e49c473f474810d2f113 /fs/ext4 | |
parent | 94a197c6bc4976fdec2ea37a0612df226839c541 (diff) | |
download | lwn-d6b55805ac4ffbcd63bf74ce572cc7a94f15be9e.tar.gz lwn-d6b55805ac4ffbcd63bf74ce572cc7a94f15be9e.zip |
ext4: fix online resize with a non-standard blocks per group setting
commit 3d2660d0c9c2f296837078c189b68a47f6b2e3b5 upstream.
The set_flexbg_block_bitmap() function assumed that the number of
blocks in a blockgroup was sb->blocksize * 8, which is normally true,
but not always! Use EXT4_BLOCKS_PER_GROUP(sb) instead, to fix block
bitmap corruption after:
mke2fs -t ext4 -g 3072 -i 4096 /dev/vdd 1G
mount -t ext4 /dev/vdd /vdd
resize2fs /dev/vdd 8G
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Jon Bernard <jbernard@tuxion.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/resize.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 6bb79434861f..c503850a61a8 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -404,7 +404,7 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle, start = ext4_group_first_block_no(sb, group); group -= flex_gd->groups[0].group; - count2 = sb->s_blocksize * 8 - (block - start); + count2 = EXT4_BLOCKS_PER_GROUP(sb) - (block - start); if (count2 > count) count2 = count; |