public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [RFC v2 1/2] xfs: create a daily warning mechanism
Date: Fri, 11 Sep 2015 14:53:54 -0400	[thread overview]
Message-ID: <1441997635-36644-2-git-send-email-bfoster@redhat.com> (raw)
In-Reply-To: <1441997635-36644-1-git-send-email-bfoster@redhat.com>

The warning mechanism in XFS currently uses the default ratelimit time
interval and burst parameters. The default parameters are intended to
avoid flooding the logs and whatnot due to messages within fairly short
timeframes (e.g., 10 messages within 5s). The forthcoming invalid
metadata LSN detection must provide a consistent, but not incessant
warning to the user that a repair is required to reformat the log.

Update the core ratelimit mechanism to allow customized parameters,
continue to pass the ratelimit defaults for existing users, and define a
new xfs_warn_daily() mechanism to fire a message on a 24 hour interval.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/xfs_message.h | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_message.h b/fs/xfs/xfs_message.h
index 8540115..9f1a036 100644
--- a/fs/xfs/xfs_message.h
+++ b/fs/xfs/xfs_message.h
@@ -30,15 +30,22 @@ void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
 }
 #endif
 
-#define xfs_printk_ratelimited(func, dev, fmt, ...)		\
+#define __xfs_printk_ratelimited(interval, burst, func, dev, fmt, ...)	\
 do {									\
-	static DEFINE_RATELIMIT_STATE(_rs,				\
-				      DEFAULT_RATELIMIT_INTERVAL,	\
-				      DEFAULT_RATELIMIT_BURST);		\
+	static DEFINE_RATELIMIT_STATE(_rs, interval, burst);		\
 	if (__ratelimit(&_rs))						\
 		func(dev, fmt, ##__VA_ARGS__);			\
 } while (0)
 
+#define xfs_printk_ratelimited(func, dev, fmt, ...)		\
+	__xfs_printk_ratelimited(DEFAULT_RATELIMIT_INTERVAL,	\
+				 DEFAULT_RATELIMIT_BURST,	\
+				 func, dev, fmt, ##__VA_ARGS__)
+
+#define xfs_printk_daily(func, dev, fmt, ...)			\
+	__xfs_printk_ratelimited(86400 * HZ, 1, func, dev, fmt,	\
+				 ##__VA_ARGS__)
+
 #define xfs_emerg_ratelimited(dev, fmt, ...)				\
 	xfs_printk_ratelimited(xfs_emerg, dev, fmt, ##__VA_ARGS__)
 #define xfs_alert_ratelimited(dev, fmt, ...)				\
@@ -56,6 +63,9 @@ do {									\
 #define xfs_debug_ratelimited(dev, fmt, ...)				\
 	xfs_printk_ratelimited(xfs_debug, dev, fmt, ##__VA_ARGS__)
 
+#define xfs_warn_daily(dev, fmt, ...)					\
+	xfs_printk_daily(xfs_warn, dev, fmt, ##__VA_ARGS__)
+
 extern void assfail(char *expr, char *f, int l);
 extern void asswarn(char *expr, char *f, int l);
 
-- 
2.1.0

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2015-09-11 18:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 18:53 [RFC v2 0/2] xfs: detect and warn about invalid metadata lsns Brian Foster
2015-09-11 18:53 ` Brian Foster [this message]
2015-09-11 18:53 ` [RFC v2 2/2] xfs: validate metadata LSNs against log on v5 superblocks Brian Foster
2015-09-22  8:07   ` Dave Chinner
2015-09-22 14:21     ` Brian Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441997635-36644-2-git-send-email-bfoster@redhat.com \
    --to=bfoster@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox