aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/journal.c
diff options
context:
space:
mode:
authorJoseph Qi <joseph.qi@huawei.com>2014-06-04 19:06:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 19:53:54 -0400
commit55b465b66809368b459674b9d205010730953c2e (patch)
tree0131f2364c0bde608a54317a323dea5769479d42 /fs/ocfs2/journal.c
parentb3821c3f866a1c02d1537ab67abe9a824d1353ae (diff)
ocfs2: limit printk when journal is aborted
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 the system hanging. So limit printk in this case. [akpm@linux-foundation.org: document the msleep] Signed-off-by: Joseph Qi <joseph.qi@huawei.com> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r--fs/ocfs2/journal.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 03ea9314fecd..4b0c68849b36 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -30,6 +30,7 @@
30#include <linux/kthread.h> 30#include <linux/kthread.h>
31#include <linux/time.h> 31#include <linux/time.h>
32#include <linux/random.h> 32#include <linux/random.h>
33#include <linux/delay.h>
33 34
34#include <cluster/masklog.h> 35#include <cluster/masklog.h>
35 36
@@ -2185,8 +2186,20 @@ static int ocfs2_commit_thread(void *arg)
2185 || kthread_should_stop()); 2186 || kthread_should_stop());
2186 2187
2187 status = ocfs2_commit_cache(osb); 2188 status = ocfs2_commit_cache(osb);
2188 if (status < 0) 2189 if (status < 0) {
2189 mlog_errno(status); 2190 static unsigned long abort_warn_time;
2191
2192 /* Warn about this once per minute */
2193 if (printk_timed_ratelimit(&abort_warn_time, 60*HZ))
2194 mlog(ML_ERROR, "status = %d, journal is "
2195 "already aborted.\n", status);
2196 /*
2197 * After ocfs2_commit_cache() fails, j_num_trans has a
2198 * non-zero value. Sleep here to avoid a busy-wait
2199 * loop.
2200 */
2201 msleep_interruptible(1000);
2202 }
2190 2203
2191 if (kthread_should_stop() && atomic_read(&journal->j_num_trans)){ 2204 if (kthread_should_stop() && atomic_read(&journal->j_num_trans)){
2192 mlog(ML_KTHREAD, 2205 mlog(ML_KTHREAD,