[Devel] [PATCH RHEL7 COMMIT] fs/ext4: Tweak to disable "lazytime" mount option by default

Konstantin Khorenko khorenko at virtuozzo.com
Mon Aug 29 14:24:37 MSK 2022


The commit is pushed to "branch-rh7-3.10.0-1160.76.1.vz7.189.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.76.1.vz7.189.1
------>
commit 83999aa9e4c0e58977ee2fd2429d93b7d8e0e224
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Aug 26 14:24:58 2022 +0300

    fs/ext4: Tweak to disable "lazytime" mount option by default
    
    There is a theoretical deadlock if a lazytime-enabled mounted ploop is
    running on top of a fuse-based vStorage which we have faced now on
    practice (vStorage was very slow, running on 1Gb network).
    
    So we have to fix that deadlock, but until it's fixed let's introduce
    a tweak to disable default lazytime option which we have introduced in
    f198023f31c67 ("fs/ext4: Make "lazytime" mount option by default").
    
    Let's implement the sysctl as the "fs.lazytime_default" sysctl.
    
    https://jira.sw.ru/browse/PSBM-141577
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 fs/ext4/super.c        |  2 +-
 include/linux/sysctl.h |  1 +
 kernel/sysctl.c        | 12 ++++++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 2d7c1d7c4190f..e7f5f147af5a8 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4072,7 +4072,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 	 * enable "lazytime" mount option for all ext4 mounts by default
 	 * Use -o nolazytime to turn it off
 	 */
-	if (!IS_EXT3_SB(sb) && !IS_EXT2_SB(sb))
+	if (!IS_EXT3_SB(sb) && !IS_EXT2_SB(sb) && lazytime_default)
 		sb->s_flags |= MS_LAZYTIME;
 
 	/*
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 1a8a5c6eb80cf..f28d9fb58c03f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -187,6 +187,7 @@ struct ctl_path {
 };
 
 extern int ve_allow_module_load;
+extern int __read_mostly lazytime_default;
 extern int trusted_exec;
 
 #ifdef CONFIG_SYSCTL
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 6e2645dae41bb..6ccebbfaf9c87 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -119,6 +119,9 @@ extern int sysctl_nr_trim_pages;
 
 int ve_allow_module_load = 1;
 EXPORT_SYMBOL(ve_allow_module_load);
+int __read_mostly lazytime_default = 1;
+EXPORT_SYMBOL(lazytime_default);
+
 int trusted_exec = 0;
 static int __init set_trusted_exec(char *str)
 {
@@ -1744,6 +1747,15 @@ static struct ctl_table fs_table[] = {
 		.mode		= 0644,
 		.proc_handler	= &proc_dointvec,
 	},
+        {
+		.procname       = "lazytime_default",
+		.data           = &lazytime_default,
+		.maxlen         = sizeof(int),
+		.mode           = 0644,
+		.proc_handler   = &proc_dointvec_minmax,
+		.extra1		= &zero,
+		.extra2		= &one,
+	},
 	{
 		.procname	= "inode-nr",
 		.data		= &inodes_stat,


More information about the Devel mailing list