1 ext4: fix corruption when online resizing a fs with 1K block size
3 From: Maarten ter Huurne <maarten@treewalker.org>
5 Subtracting the number of the first data block places the superblock
6 backups one block too early, corrupting the file system. When the block
7 size is larger than 1K, the first data block is 0, so the subtraction
8 has no effect and no corruption occurs.
10 Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
11 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 Reviewed-by: Jan Kara <jack@suse.cz>
14 fs/ext4/resize.c | 4 +---
15 1 file changed, 1 insertion(+), 3 deletions(-)
17 diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
18 index c169477..116c80d 100644
19 --- a/fs/ext4/resize.c
20 +++ b/fs/ext4/resize.c
21 @@ -1654,12 +1654,10 @@ errout:
25 - ext4_fsblk_t first_block;
26 - first_block = ext4_group_first_block_no(sb, 0);
27 if (test_opt(sb, DEBUG))
28 printk(KERN_DEBUG "EXT4-fs: extended group to %llu "
29 "blocks\n", ext4_blocks_count(es));
30 - update_backups(sb, EXT4_SB(sb)->s_sbh->b_blocknr - first_block,
31 + update_backups(sb, EXT4_SB(sb)->s_sbh->b_blocknr,
32 (char *)es, sizeof(struct ext4_super_block), 0);