Skip to content

Commit a408f33

Browse files
LiBaokun96tytso
authored andcommitted
ext4: fix bad checksum after online resize
When online resizing is performed twice consecutively, the error message "Superblock checksum does not match superblock" is displayed for the second time. Here's the reproducer: mkfs.ext4 -F /dev/sdb 100M mount /dev/sdb /tmp/test resize2fs /dev/sdb 5G resize2fs /dev/sdb 6G To solve this issue, we moved the update of the checksum after the es->s_overhead_clusters is updated. Fixes: 026d0d2 ("ext4: reduce computation of overhead during resize") Fixes: de394a8 ("ext4: update s_overhead_clusters in the superblock during an on-line resize") Signed-off-by: Baokun Li <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Reviewed-by: Jan Kara <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent a7e9d97 commit a408f33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ext4/resize.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1476,8 +1476,6 @@ static void ext4_update_super(struct super_block *sb,
14761476
* active. */
14771477
ext4_r_blocks_count_set(es, ext4_r_blocks_count(es) +
14781478
reserved_blocks);
1479-
ext4_superblock_csum_set(sb);
1480-
unlock_buffer(sbi->s_sbh);
14811479

14821480
/* Update the free space counts */
14831481
percpu_counter_add(&sbi->s_freeclusters_counter,
@@ -1513,6 +1511,8 @@ static void ext4_update_super(struct super_block *sb,
15131511
ext4_calculate_overhead(sb);
15141512
es->s_overhead_clusters = cpu_to_le32(sbi->s_overhead);
15151513

1514+
ext4_superblock_csum_set(sb);
1515+
unlock_buffer(sbi->s_sbh);
15161516
if (test_opt(sb, DEBUG))
15171517
printk(KERN_DEBUG "EXT4-fs: added group %u:"
15181518
"%llu blocks(%llu free %llu reserved)\n", flex_gd->count,

0 commit comments

Comments
 (0)