Skip to content

Commit 4f97a68

Browse files
committed
ext4: fix support for inode sizes > 1024 bytes
A recent commit, 9803387 ("ext4: validate the debug_want_extra_isize mount option at parse time"), moved mount-time checks around. One of those changes moved the inode size check before the blocksize variable was set to the blocksize of the file system. After 9803387 was set to the minimum allowable blocksize, which in practice on most systems would be 1024 bytes. This cuased file systems with inode sizes larger than 1024 bytes to be rejected with a message: EXT4-fs (sdXX): unsupported inode size: 4096 Fixes: 9803387 ("ext4: validate the debug_want_extra_isize mount option at parse time") Link: https://lore.kernel.org/r/[email protected] Reported-by: Herbert Poetzl <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]> Cc: [email protected]
1 parent 46d3688 commit 4f97a68

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

fs/ext4/super.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3814,6 +3814,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
38143814
*/
38153815
sbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT;
38163816

3817+
blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
3818+
if (blocksize < EXT4_MIN_BLOCK_SIZE ||
3819+
blocksize > EXT4_MAX_BLOCK_SIZE) {
3820+
ext4_msg(sb, KERN_ERR,
3821+
"Unsupported filesystem blocksize %d (%d log_block_size)",
3822+
blocksize, le32_to_cpu(es->s_log_block_size));
3823+
goto failed_mount;
3824+
}
3825+
38173826
if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV) {
38183827
sbi->s_inode_size = EXT4_GOOD_OLD_INODE_SIZE;
38193828
sbi->s_first_ino = EXT4_GOOD_OLD_FIRST_INO;
@@ -3831,6 +3840,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
38313840
ext4_msg(sb, KERN_ERR,
38323841
"unsupported inode size: %d",
38333842
sbi->s_inode_size);
3843+
ext4_msg(sb, KERN_ERR, "blocksize: %d", blocksize);
38343844
goto failed_mount;
38353845
}
38363846
/*
@@ -4033,14 +4043,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
40334043
if (!ext4_feature_set_ok(sb, (sb_rdonly(sb))))
40344044
goto failed_mount;
40354045

4036-
blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
4037-
if (blocksize < EXT4_MIN_BLOCK_SIZE ||
4038-
blocksize > EXT4_MAX_BLOCK_SIZE) {
4039-
ext4_msg(sb, KERN_ERR,
4040-
"Unsupported filesystem blocksize %d (%d log_block_size)",
4041-
blocksize, le32_to_cpu(es->s_log_block_size));
4042-
goto failed_mount;
4043-
}
40444046
if (le32_to_cpu(es->s_log_block_size) >
40454047
(EXT4_MAX_BLOCK_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {
40464048
ext4_msg(sb, KERN_ERR,

0 commit comments

Comments
 (0)