2020-09-18 02:04:45

by Sasha Levin

[permalink] [raw]
Subject: [PATCH AUTOSEL 5.4 105/330] ext4: make dioread_nolock the default

From: Theodore Ts'o <[email protected]>

[ Upstream commit 244adf6426ee31a83f397b700d964cff12a247d3 ]

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]>
Signed-off-by: Sasha Levin <[email protected]>
---
fs/ext4/super.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 4aae7e3e89a12..c32b8161ad3e9 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1546,6 +1546,7 @@ static const match_table_t tokens = {
{Opt_auto_da_alloc, "auto_da_alloc"},
{Opt_noauto_da_alloc, "noauto_da_alloc"},
{Opt_dioread_nolock, "dioread_nolock"},
+ {Opt_dioread_lock, "nodioread_nolock"},
{Opt_dioread_lock, "dioread_lock"},
{Opt_discard, "discard"},
{Opt_nodiscard, "nodiscard"},
@@ -3750,6 +3751,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
set_opt(sb, NO_UID32);
/* xattr user namespace & acls are now defaulted on */
set_opt(sb, XATTR_USER);
+ set_opt(sb, DIOREAD_NOLOCK);
#ifdef CONFIG_EXT4_FS_POSIX_ACL
set_opt(sb, POSIX_ACL);
#endif
@@ -3927,9 +3929,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
#endif

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


2020-09-18 14:06:39

by Ritesh Harjani

[permalink] [raw]
Subject: Re: [PATCH AUTOSEL 5.4 105/330] ext4: make dioread_nolock the default

Hello Sasha,

On 9/18/20 7:27 AM, Sasha Levin wrote:
> From: Theodore Ts'o <[email protected]>
>
> [ Upstream commit 244adf6426ee31a83f397b700d964cff12a247d3 ]
>
> 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]>
> Signed-off-by: Sasha Levin <[email protected]>

I see that the subjected patch is being taken into many different stable
trees. I remember there was a fixes patch on top of this[1].
Below thread[1] has more details. Just wanted to point this one out.
Please ignore if already taken.

[1]: https://www.spinics.net/lists/linux-ext4/msg72219.html

-ritesh