From 25ecfc1f07cf736aa89590f01ca4f45101af4329 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 16 Aug 2015 10:06:52 -0400 Subject: [PATCH] add patch ratelimit-mount-message --- ratelimit-mount-message | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ series | 1 + 2 files changed, 49 insertions(+) create mode 100644 ratelimit-mount-message diff --git a/ratelimit-mount-message b/ratelimit-mount-message new file mode 100644 index 00000000..cbe7eb38 --- /dev/null +++ b/ratelimit-mount-message @@ -0,0 +1,48 @@ +ext4: ratelimit the file system mounted message + +The xfstests ext4/305 will mount and unmount the same file system over +4,000 times, and each one of these will cause a system log message. +Ratelimit this message since if we are getting more than a few dozen +of these messages, they probably aren't going to be helpful. + +Signed-off-by: Theodore Ts'o + + +--- + fs/ext4/super.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 70c52ea..45658c1 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -60,6 +60,7 @@ static struct ext4_lazy_init *ext4_li_info; + static struct mutex ext4_li_mtx; + static struct ext4_features *ext4_feat; + static int ext4_mballoc_ready; ++static struct ratelimit_state ext4_mount_msg_ratelimit; + + static int ext4_load_journal(struct super_block *, struct ext4_super_block *, + unsigned long journal_devnum); +@@ -4277,9 +4278,10 @@ no_journal: + "the device does not support discard"); + } + +- ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. " +- "Opts: %s%s%s", descr, sbi->s_es->s_mount_opts, +- *sbi->s_es->s_mount_opts ? "; " : "", orig_data); ++ if (___ratelimit(&ext4_mount_msg_ratelimit, "EXT4-fs mount")) ++ ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. " ++ "Opts: %s%s%s", descr, sbi->s_es->s_mount_opts, ++ *sbi->s_es->s_mount_opts ? "; " : "", orig_data); + + if (es->s_error_count) + mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */ +@@ -5617,6 +5619,7 @@ static int __init ext4_init_fs(void) + { + int i, err; + ++ ratelimit_state_init(&ext4_mount_msg_ratelimit, 30 * HZ, 64); + ext4_li_info = NULL; + mutex_init(&ext4_li_mtx); + diff --git a/series b/series index c4125cd5..b438958e 100644 --- a/series +++ b/series @@ -20,6 +20,7 @@ dont-manipulate-recovery-flag-when-freezing-no-journal-fs simplify-some-code-in-read-mmp_block silence-a-format-string-false-positive +ratelimit-mount-message ########################################## # unstable patches -- 2.11.4.GIT