Skip to content

Commit d85400a

Browse files
biger410torvalds
authored andcommitted
ocfs2: clear journal dirty flag after shutdown journal
Dirty flag of the journal should be cleared at the last stage of umount, if do it before jbd2_journal_destroy(), then some metadata in uncommitted transaction could be lost due to io error, but as dirty flag of journal was already cleared, we can't find that until run a full fsck. This may cause system panic or other corruption. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Junxiao Bi <[email protected]> Reviewed-by: Yiwen Jiang <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Cc: Jun Piao <[email protected]> Cc: Changwei Ge <[email protected]> Cc: Joel Becker <[email protected]> Cc: Mark Fasheh <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 532e1e5 commit d85400a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/ocfs2/journal.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,8 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
10171017
mlog_errno(status);
10181018
}
10191019

1020-
if (status == 0) {
1020+
/* Shutdown the kernel journal system */
1021+
if (!jbd2_journal_destroy(journal->j_journal) && !status) {
10211022
/*
10221023
* Do not toggle if flush was unsuccessful otherwise
10231024
* will leave dirty metadata in a "clean" journal
@@ -1026,9 +1027,6 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
10261027
if (status < 0)
10271028
mlog_errno(status);
10281029
}
1029-
1030-
/* Shutdown the kernel journal system */
1031-
jbd2_journal_destroy(journal->j_journal);
10321030
journal->j_journal = NULL;
10331031

10341032
OCFS2_I(inode)->ip_open_count--;

0 commit comments

Comments
 (0)