Skip to content

Commit 8efca48

Browse files
biger410jfvogel
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]> (cherry picked from commit d85400a) Orabug: 29154599 Signed-off-by: Junxiao Bi <[email protected]> Reviewed-by: Ashish Samant <[email protected]>
1 parent c65dce5 commit 8efca48

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
@@ -1016,7 +1016,8 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
10161016
mlog_errno(status);
10171017
}
10181018

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

10331031
OCFS2_I(inode)->ip_open_count--;

0 commit comments

Comments
 (0)