Skip to content

Commit 261cb20

Browse files
jankaratytso
authored andcommitted
ext4: check dioread_nolock on remount
Currently we allow enabling dioread_nolock mount option on remount for filesystems where blocksize < PAGE_CACHE_SIZE. This isn't really supported so fix the bug by moving the check for blocksize != PAGE_CACHE_SIZE into parse_options(). Change the original PAGE_SIZE to PAGE_CACHE_SIZE along the way because that's what we are really interested in. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Reviewed-by: Eric Sandeen <[email protected]> Cc: [email protected]
1 parent c36575e commit 261cb20

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

fs/ext4/super.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,9 +1645,7 @@ static int parse_options(char *options, struct super_block *sb,
16451645
unsigned int *journal_ioprio,
16461646
int is_remount)
16471647
{
1648-
#ifdef CONFIG_QUOTA
16491648
struct ext4_sb_info *sbi = EXT4_SB(sb);
1650-
#endif
16511649
char *p;
16521650
substring_t args[MAX_OPT_ARGS];
16531651
int token;
@@ -1696,6 +1694,16 @@ static int parse_options(char *options, struct super_block *sb,
16961694
}
16971695
}
16981696
#endif
1697+
if (test_opt(sb, DIOREAD_NOLOCK)) {
1698+
int blocksize =
1699+
BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
1700+
1701+
if (blocksize < PAGE_CACHE_SIZE) {
1702+
ext4_msg(sb, KERN_ERR, "can't mount with "
1703+
"dioread_nolock if block size != PAGE_SIZE");
1704+
return 0;
1705+
}
1706+
}
16991707
return 1;
17001708
}
17011709

@@ -3436,15 +3444,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
34363444
clear_opt(sb, DELALLOC);
34373445
}
34383446

3439-
blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
3440-
if (test_opt(sb, DIOREAD_NOLOCK)) {
3441-
if (blocksize < PAGE_SIZE) {
3442-
ext4_msg(sb, KERN_ERR, "can't mount with "
3443-
"dioread_nolock if block size != PAGE_SIZE");
3444-
goto failed_mount;
3445-
}
3446-
}
3447-
34483447
sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
34493448
(test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
34503449

@@ -3486,6 +3485,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
34863485
if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY)))
34873486
goto failed_mount;
34883487

3488+
blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
34893489
if (blocksize < EXT4_MIN_BLOCK_SIZE ||
34903490
blocksize > EXT4_MAX_BLOCK_SIZE) {
34913491
ext4_msg(sb, KERN_ERR,

0 commit comments

Comments
 (0)