From: Mark Fasheh <mfasheh@suse.de>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: limit printk when journal is aborted
Date: Thu, 17 Apr 2014 14:01:32 -0700 [thread overview]
Message-ID: <20140417210132.GB27178@wotan.suse.de> (raw)
In-Reply-To: <534FB63A.9090402@huawei.com>
On Thu, Apr 17, 2014 at 07:08:42PM +0800, Joseph Qi wrote:
>
> Once JBD2_ABORT is set, ocfs2_commit_cache will fail in
> ocfs2_commit_thread. Then it will get into a loop with mass logs. This
> will meaninglessly consume a larger number of resource and may lead to
> system hung at last.
> So limit printk in this case.
>
> Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
> ---
> fs/ocfs2/journal.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
> index 44fc3e5..cfefbd1 100644
> --- a/fs/ocfs2/journal.c
> +++ b/fs/ocfs2/journal.c
> @@ -30,6 +30,7 @@
> #include <linux/kthread.h>
> #include <linux/time.h>
> #include <linux/random.h>
> +#include <linux/delay.h>
>
> #include <cluster/masklog.h>
>
> @@ -2191,8 +2192,15 @@ static int ocfs2_commit_thread(void *arg)
> || kthread_should_stop());
>
> status = ocfs2_commit_cache(osb);
> - if (status < 0)
> - mlog_errno(status);
> + if (status < 0) {
> + static unsigned long abort_warn_time;
> +
> + /* Warn about this once per minute */
> + if (printk_timed_ratelimit(&abort_warn_time, 60*HZ))
> + mlog(ML_ERROR, "status = %d, journal is "
> + "already aborted.\n", status);
> + msleep_interruptible(1000);
> + }
Why the msleep? ocfs2_commit_thread will wait on the checkpoint_event queue
right after this anyway - is there a problem with it waiting on that?
Generally I really don't like peppering msleep() into the code where we
might need to sleep - there is often a more elegant solution available.
Thanks,
--Mark
--
Mark Fasheh
next prev parent reply other threads:[~2014-04-17 21:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-17 11:08 [Ocfs2-devel] [PATCH] ocfs2: limit printk when journal is aborted Joseph Qi
2014-04-17 21:01 ` Mark Fasheh [this message]
2014-04-18 1:02 ` Joseph Qi
2014-04-18 2:45 ` Mark Fasheh
2014-04-18 9:18 ` Joseph Qi
2014-04-21 19:18 ` Andrew Morton
2014-04-21 20:51 ` Mark Fasheh
2014-04-22 1:08 ` Joseph Qi
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=20140417210132.GB27178@wotan.suse.de \
--to=mfasheh@suse.de \
--cc=ocfs2-devel@oss.oracle.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;
as well as URLs for NNTP newsgroup(s).