From 74502e1a84f8a21de6a54d0671d3da07b72d9985 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 18 Oct 2015 00:37:51 -0400 Subject: [PATCH] add patch fix-calculation-of-meta_bg-descriptor-backups --- fix-calculation-of-meta_bg-descriptor-backups | 57 +++++++++++++++++++++++++++ series | 1 + timestamps | 5 ++- 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 fix-calculation-of-meta_bg-descriptor-backups diff --git a/fix-calculation-of-meta_bg-descriptor-backups b/fix-calculation-of-meta_bg-descriptor-backups new file mode 100644 index 00000000..b4f76606 --- /dev/null +++ b/fix-calculation-of-meta_bg-descriptor-backups @@ -0,0 +1,57 @@ +Subject: [PATCH] fix calculation of meta_bg descriptor backups + +From: Andy Leiserson + +"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 +Signed-off-by: Theodore Ts'o +Cc: stable@vger.kernel.org +--- + fs/ext4/resize.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c +index cf0c472..c7c53fd 100644 +--- a/fs/ext4/resize.c ++++ b/fs/ext4/resize.c +@@ -1040,7 +1040,7 @@ exit_free: + * do not copy the full number of backups at this time. The resize + * which changed s_groups_count will backup again. + */ +-static void update_backups(struct super_block *sb, int blk_off, char *data, ++static void update_backups(struct super_block *sb, sector_t blk_off, char *data, + int size, int meta_bg) + { + struct ext4_sb_info *sbi = EXT4_SB(sb); +@@ -1065,7 +1065,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, + group = ext4_list_backups(sb, &three, &five, &seven); + last = sbi->s_groups_count; + } else { +- group = ext4_meta_bg_first_group(sb, group) + 1; ++ group = ext4_get_group_number(sb, blk_off) + 1; + last = (ext4_group_t)(group + EXT4_DESC_PER_BLOCK(sb) - 2); + } + +-- +2.5.3 + +-- +To unsubscribe from this list: send the line "unsubscribe linux-ext4" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + diff --git a/series b/series index 5f49e765..c274aa1c 100644 --- a/series +++ b/series @@ -22,6 +22,7 @@ make-the-bitmap-read-routines-return-real-errors-code fix-xfstest-generic-269-double-revoked-buffer-bug fix-checkpoint-list-cleanup fix-potential-use-after-free-in-ext4_journal-stop +fix-calculation-of-meta_bg-descriptor-backups ########################################## # unstable patches diff --git a/timestamps b/timestamps index da734c0e..df0be352 100755 --- a/timestamps +++ b/timestamps @@ -45,7 +45,8 @@ touch -d @1445132004 make-the-bitmap-read-routines-return-real-errors-code touch -d @1445132064 stable-boundary touch -d @1445135301 fix-xfstest-generic-269-double-revoked-buffer-bug touch -d @1445135709 fix-checkpoint-list-cleanup -touch -d @1445137007 series -touch -d @1445137011 status touch -d @1445137026 fix-potential-use-after-free-in-ext4_journal-stop touch -d @1445137064 timestamps +touch -d @1445142978 series +touch -d @1445142989 fix-calculation-of-meta_bg-descriptor-backups +touch -d @1445142999 status -- 2.11.4.GIT