aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Leiserson <andy@leiserson.org>2015-10-18 00:36:29 -0400
committerTheodore Ts'o <tytso@mit.edu>2015-10-18 00:36:29 -0400
commit904dad4742d211b7a8910e92695c0fa957483836 (patch)
tree92bcba5b4383de27a97252217e217bef910f1e92
parent6934da9238da947628be83635e365df41064b09b (diff)
[PATCH] fix calculation of meta_bg descriptor backups
"group" is the group where the backup will be placed, and is initialized to zero in the declaration. This meant that backups for meta_bg descriptors were erroneously written to the backup block group descriptors in groups 1 and (desc_per_block-1). Reproduction information: mke2fs -Fq -t ext4 -b 1024 -O ^resize_inode /tmp/foo.img 16G truncate -s 24G /tmp/foo.img losetup /dev/loop0 /tmp/foo.img mount /dev/loop0 /mnt resize2fs /dev/loop0 umount /dev/loop0 dd if=/dev/zero of=/dev/loop0 bs=1024 count=2 e2fsck -fy /dev/loop0 losetup -d /dev/loop0 Signed-off-by: Andy Leiserson <andy@leiserson.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@vger.kernel.org
-rw-r--r--fs/ext4/resize.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 469eeccee0bf..ad62d7acc315 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1039,7 +1039,7 @@ exit_free:
1039 * do not copy the full number of backups at this time. The resize 1039 * do not copy the full number of backups at this time. The resize
1040 * which changed s_groups_count will backup again. 1040 * which changed s_groups_count will backup again.
1041 */ 1041 */
1042static void update_backups(struct super_block *sb, int blk_off, char *data, 1042static void update_backups(struct super_block *sb, sector_t blk_off, char *data,
1043 int size, int meta_bg) 1043 int size, int meta_bg)
1044{ 1044{
1045 struct ext4_sb_info *sbi = EXT4_SB(sb); 1045 struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -1064,7 +1064,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data,
1064 group = ext4_list_backups(sb, &three, &five, &seven); 1064 group = ext4_list_backups(sb, &three, &five, &seven);
1065 last = sbi->s_groups_count; 1065 last = sbi->s_groups_count;
1066 } else { 1066 } else {
1067 group = ext4_meta_bg_first_group(sb, group) + 1; 1067 group = ext4_get_group_number(sb, blk_off) + 1;
1068 last = (ext4_group_t)(group + EXT4_DESC_PER_BLOCK(sb) - 2); 1068 last = (ext4_group_t)(group + EXT4_DESC_PER_BLOCK(sb) - 2);
1069 } 1069 }
1070 1070