Skip to content

Commit 244adf6

Browse files
committed
ext4: make dioread_nolock the default
This fixes the direct I/O versus writeback race which can reveal stale data, and it improves the tail latency of commits on slow devices. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 4068664 commit 244adf6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/ext4/super.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,7 @@ static const match_table_t tokens = {
15921592
{Opt_auto_da_alloc, "auto_da_alloc"},
15931593
{Opt_noauto_da_alloc, "noauto_da_alloc"},
15941594
{Opt_dioread_nolock, "dioread_nolock"},
1595+
{Opt_dioread_lock, "nodioread_nolock"},
15951596
{Opt_dioread_lock, "dioread_lock"},
15961597
{Opt_discard, "discard"},
15971598
{Opt_nodiscard, "nodiscard"},
@@ -3764,6 +3765,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
37643765
set_opt(sb, NO_UID32);
37653766
/* xattr user namespace & acls are now defaulted on */
37663767
set_opt(sb, XATTR_USER);
3768+
set_opt(sb, DIOREAD_NOLOCK);
37673769
#ifdef CONFIG_EXT4_FS_POSIX_ACL
37683770
set_opt(sb, POSIX_ACL);
37693771
#endif
@@ -3931,9 +3933,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
39313933
#endif
39323934

39333935
if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
3934-
printk_once(KERN_WARNING "EXT4-fs: Warning: mounting "
3935-
"with data=journal disables delayed "
3936-
"allocation and O_DIRECT support!\n");
3936+
printk_once(KERN_WARNING "EXT4-fs: Warning: mounting with data=journal disables delayed allocation, dioread_nolock, and O_DIRECT support!\n");
3937+
clear_opt(sb, DIOREAD_NOLOCK);
39373938
if (test_opt2(sb, EXPLICIT_DELALLOC)) {
39383939
ext4_msg(sb, KERN_ERR, "can't mount with "
39393940
"both data=journal and delalloc");

0 commit comments

Comments
 (0)