Skip to content

Commit 626b035

Browse files
riteshharjanitytso
authored andcommitted
ext4: don't set dioread_nolock by default for blocksize < pagesize
Currently on calling echo 3 > drop_caches on host machine, we see FS corruption in the guest. This happens on Power machine where blocksize < pagesize. So as a temporary workaound don't enable dioread_nolock by default for blocksize < pagesize until we identify the root cause. Also emit a warning msg in case if this mount option is manually enabled for blocksize < pagesize. Reported-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Ritesh Harjani <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent c8980e1 commit 626b035

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

fs/ext4/super.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2187,6 +2187,14 @@ static int parse_options(char *options, struct super_block *sb,
21872187
}
21882188
}
21892189
#endif
2190+
if (test_opt(sb, DIOREAD_NOLOCK)) {
2191+
int blocksize =
2192+
BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
2193+
if (blocksize < PAGE_SIZE)
2194+
ext4_msg(sb, KERN_WARNING, "Warning: mounting with an "
2195+
"experimental mount option 'dioread_nolock' "
2196+
"for blocksize < PAGE_SIZE");
2197+
}
21902198
return 1;
21912199
}
21922200

@@ -3793,7 +3801,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
37933801
set_opt(sb, NO_UID32);
37943802
/* xattr user namespace & acls are now defaulted on */
37953803
set_opt(sb, XATTR_USER);
3796-
set_opt(sb, DIOREAD_NOLOCK);
37973804
#ifdef CONFIG_EXT4_FS_POSIX_ACL
37983805
set_opt(sb, POSIX_ACL);
37993806
#endif
@@ -3843,6 +3850,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
38433850
sbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT;
38443851

38453852
blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
3853+
3854+
if (blocksize == PAGE_SIZE)
3855+
set_opt(sb, DIOREAD_NOLOCK);
3856+
38463857
if (blocksize < EXT4_MIN_BLOCK_SIZE ||
38473858
blocksize > EXT4_MAX_BLOCK_SIZE) {
38483859
ext4_msg(sb, KERN_ERR,

0 commit comments

Comments
 (0)