diff options
author | Joseph Qi <joseph.qi@huawei.com> | 2015-06-24 19:55:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-24 20:49:39 -0400 |
commit | e272e7f0fbfbe4e6e5d89cd61064d6dddd73e81b (patch) | |
tree | c08cae5a726621119fcdb90d9798747d4e352497 | |
parent | 099768b0c605f55167c0c211afbfeeeea79b56eb (diff) |
ocfs2: do not BUG if jbd2_journal_dirty_metadata fails
jbd2_journal_dirty_metadata may fail. Currently it cannot take care of
non zero return value and just BUG in ocfs2_journal_dirty. This patch is
aborting the handle and journal instead of BUG.
Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Cc: joyce.xue <xuejiufei@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ocfs2/journal.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 4205da06000d..72db49c0e2ab 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -775,7 +775,20 @@ void ocfs2_journal_dirty(handle_t *handle, struct buffer_head *bh) | |||
775 | trace_ocfs2_journal_dirty((unsigned long long)bh->b_blocknr); | 775 | trace_ocfs2_journal_dirty((unsigned long long)bh->b_blocknr); |
776 | 776 | ||
777 | status = jbd2_journal_dirty_metadata(handle, bh); | 777 | status = jbd2_journal_dirty_metadata(handle, bh); |
778 | BUG_ON(status); | 778 | if (status) { |
779 | mlog_errno(status); | ||
780 | if (!is_handle_aborted(handle)) { | ||
781 | journal_t *journal = handle->h_transaction->t_journal; | ||
782 | struct super_block *sb = bh->b_bdev->bd_super; | ||
783 | |||
784 | mlog(ML_ERROR, "jbd2_journal_dirty_metadata failed. " | ||
785 | "Aborting transaction and journal.\n"); | ||
786 | handle->h_err = status; | ||
787 | jbd2_journal_abort_handle(handle); | ||
788 | jbd2_journal_abort(journal, status); | ||
789 | ocfs2_abort(sb, "Journal already aborted.\n"); | ||
790 | } | ||
791 | } | ||
779 | } | 792 | } |
780 | 793 | ||
781 | #define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE) | 794 | #define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE) |