This is a note to let you know that I've just added the patch titled ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ext4-remove-gdb-backup-copy-for-meta-bg-in-setup_new_flex_group_blocks.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 40dd7953f4d606c280074f10d23046b6812708ce Mon Sep 17 00:00:00 2001 From: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx> Date: Sun, 27 Aug 2023 01:47:03 +0800 Subject: ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks From: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx> commit 40dd7953f4d606c280074f10d23046b6812708ce upstream. Wrong check of gdb backup in meta bg as following: first_group is the first group of meta_bg which contains target group, so target group is always >= first_group. We check if target group has gdb backup by comparing first_group with [group + 1] and [group + EXT4_DESC_PER_BLOCK(sb) - 1]. As group >= first_group, then [group + N] is > first_group. So no copy of gdb backup in meta bg is done in setup_new_flex_group_blocks. No need to do gdb backup copy in meta bg from setup_new_flex_group_blocks as we always copy updated gdb block to backups at end of ext4_flex_group_add as following: ext4_flex_group_add /* no gdb backup copy for meta bg any more */ setup_new_flex_group_blocks /* update current group number */ ext4_update_super sbi->s_groups_count += flex_gd->count; /* * if group in meta bg contains backup is added, the primary gdb block * of the meta bg will be copy to backup in new added group here. */ for (; gdb_num <= gdb_num_end; gdb_num++) update_backups(...) In summary, we can remove wrong gdb backup copy code in setup_new_flex_group_blocks. Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx> Reviewed-by: Theodore Ts'o <tytso@xxxxxxx> Link: https://lore.kernel.org/r/20230826174712.4059355-5-shikemeng@xxxxxxxxxxxxxxx Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> Cc: stable@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ext4/resize.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -560,13 +560,8 @@ static int setup_new_flex_group_blocks(s if (meta_bg == 0 && !ext4_bg_has_super(sb, group)) goto handle_itb; - if (meta_bg == 1) { - ext4_group_t first_group; - first_group = ext4_meta_bg_first_group(sb, group); - if (first_group != group + 1 && - first_group != group + EXT4_DESC_PER_BLOCK(sb) - 1) - goto handle_itb; - } + if (meta_bg == 1) + goto handle_itb; block = start + ext4_bg_has_super(sb, group); /* Copy all of the GDT blocks into the backup in this group */ Patches currently in stable-queue which might be from shikemeng@xxxxxxxxxxxxxxx are queue-6.6/ext4-correct-offset-of-gdb-backup-in-non-meta_bg-group-to-update_backups.patch queue-6.6/ext4-remove-gdb-backup-copy-for-meta-bg-in-setup_new_flex_group_blocks.patch queue-6.6/ext4-add-missed-brelse-in-update_backups.patch queue-6.6/ext4-correct-return-value-of-ext4_convert_meta_bg.patch